If I read this part correctly
|
foreach(filename IN LISTS XTL_TESTS) |
|
get_filename_component(targetname ${filename} NAME_WE) |
|
|
|
add_executable(${targetname} main.cpp ${filename} ${XTL_HEADERS}) |
|
target_include_directories(${targetname} PRIVATE ${XTL_INCLUDE_DIR}) |
|
target_link_libraries(${targetname} xtl doctest::doctest Threads::Threads ${nlohmann_json_TARGET}) |
|
|
|
add_test(NAME ${targetname} COMMAND ${targetname}) |
|
endforeach() |
|
|
|
add_executable(test_xtl main.cpp ${XTL_TESTS} ${XTL_HEADERS}) |
|
target_include_directories(test_xtl PRIVATE ${XTL_INCLUDE_DIR}) |
|
target_link_libraries(test_xtl xtl doctest::doctest Threads::Threads ${nlohmann_json_TARGET}) |
|
|
|
add_custom_target(xtest COMMAND test_xtl DEPENDS test_xtl) |
|
add_test(NAME xtest COMMAND test_xtl) |
The ctest would run eact test twice, once in xtest and once in ${targetname}. Why not get rid of the former?
Also the custom target calling test_xtl is not very efficient because it would not be parallelized. I've seen implementations where the target is just a thin wrapper around ctest with appropriate filters/environment variables.
If I read this part correctly
xtl/test/CMakeLists.txt
Lines 120 to 135 in 174e99d
The ctest would run eact test twice, once in
xtestand once in${targetname}. Why not get rid of the former?Also the custom target calling
test_xtlis not very efficient because it would not be parallelized. I've seen implementations where the target is just a thin wrapper aroundctestwith appropriate filters/environment variables.