# Allow to easily build test suites

macro(create_test_suite NAME)
	enable_testing()
	set(TARGET "check-${NAME}")
	add_custom_target(${TARGET} COMMAND ${CMAKE_CTEST_COMMAND})

	# If the magic target check-all exists, attach to it.
	if(TARGET check-all)
		add_dependencies(check-all ${TARGET})
	endif()
endmacro(create_test_suite)

function(add_test_to_suite SUITE NAME)
	add_executable(${NAME} EXCLUDE_FROM_ALL ${ARGN})
	add_test(${NAME} ${NAME} COMMAND ${NAME})
	add_dependencies("check-${SUITE}" ${NAME})
endfunction(add_test_to_suite)

# Allow to easily build test suites

macro(create_test_suite NAME)
	enable_testing()
	set(TARGET "check-${NAME}")
	add_custom_target(${TARGET} COMMAND ${CMAKE_CTEST_COMMAND})

	# If the magic target check-all exists, attach to it.
	if(TARGET check-all)
		add_dependencies(check-all ${TARGET})
	endif()
endmacro(create_test_suite)

function(add_test_to_suite SUITE NAME)
	add_executable(${NAME} EXCLUDE_FROM_ALL ${ARGN})
	add_test(${NAME} ${NAME})
	add_dependencies("check-${SUITE}" ${NAME})
endfunction(add_test_to_suite)

Fix test run command line
[cmake] Fix test run command line

Summary: Useless arguement are passed to test, which is ok most of the time as they ignore it, but sometime, it's not.

Test Plan:
Change the command line for ctest to pass the -V flag.

  ninja check

Ensure no superfluous flags are passed.

Reviewers: #bitcoin_abc, schancel

Reviewed By: #bitcoin_abc, schancel

Subscribers: teamcity

Differential Revision: https://reviews.bitcoinabc.org/D1273
