As of now `make -jN check` executes test suite sequentially
(although it builds test executables in parallel). This takes
a bit too long, so it would be nice to run tests in parallel.
`ctest -jN` or `make test ARGS=-jN` runs tests concurrently,
however it does not build test executables, instead it fails
if any test binary is missing.
Also `test` target is a bit special and it's impossible to add
dependencies to it, see
https://gitlab.kitware.com/cmake/cmake/issues/8438
To work around the problem define `test_suite` target which
builds the tests suite without running it, so one can both
compile and run tests in parallel
make -j8 test_suite
make test ARGS=-j8
# make check
enable_testing()
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND})
+add_custom_target(test_suite)
if (WIN32)
if (NOT DEFINED CMAKE_RUNTIME_OUTPUT_DIRECTORY)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin)
endif()
add_executable(${thename} EXCLUDE_FROM_ALL ${${thename}_sources})
target_link_libraries(${thename} ginac ${LIBDL_LIBRARIES})
+ add_dependencies(test_suite ${thename})
add_dependencies(check ${thename})
add_test(NAME ${thename} COMMAND $<TARGET_FILE:${thename}>)
endmacro()