[TEST] App-template assumes exactly one binary. How do we treat several?
Irallia opened this issue · 1 comments
Irallia commented
The app-template assumes exactly one binary, but sometimes we have more. How do we want to deal with it?
In the iGenVar project, for example, we have two binaries. As a result, some CMakeLists do not work correctly.
In seqan/iGenVar#19 we got the Problem, that .../test/CMakeLists.txt
with
# Add the test to its general target (cli or api).
if (${test_alternative} STREQUAL "CLI_TEST")
add_dependencies (${target} "${PROJECT_NAME}") # cli test needs the application executable
target_include_directories(${target} PUBLIC "${SEQAN3_CLONE_DIR}/test/include")
add_dependencies (cli_test ${target})
elseif (${test_alternative} STREQUAL "API_TEST")
add_dependencies (api_test ${target})
endif ()
the dependencies are not added correctly.
There are 3 ideas to fix this (using the example of iGenVar):
add_cli_test(detect_breakends_cli_test)
, this is always done automatically via naming conventions depended ondetect_breakends
-> update.../test/CMakeLists.txt
add_cli_test(detect_breakends_cli_test DEPENDS detect_breakends fastq_conversion)
, i.e. one says which binaries the test needs- or we add a line in each test, namely:
add_dependencies (detect_breakends_cli_test "detect_breakends")
and remove this part iniGenVar/test/CMakeLists.txt
joergi-w commented
To me the second version seems the most intuitive one and in this way CMake automatically makes sure that dependent targets are available beforehand.