We will introduce small modifications in the CMake code, as shown here:
- Only one additional line is added in the top-level CMakeLists.txt, since we will include a module located under cmake:
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
- We keep src/CMakeLists.txt unmodified.
- In tests/CMakeLists.txt, we move the add_catch_test function definition to cmake/testing.cmake and define two tests:
add_executable(cpp_test test.cpp)target_link_libraries(cpp_test sum_integers)include(testing)add_catch_test( NAME short LABELS short cpp_test COST 1.5 )add_catch_test( NAME long LABELS long cpp_test COST 2.5 )
- The add_catch_test function is now defined in cmake/testing.cmake:
function(add_catch_test) set(options) ...