diff --git a/CMakeLists.txt b/CMakeLists.txt index d21294c..2a00206 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -71,7 +71,7 @@ endif() if(WITH_TESTS) add_library(${PROJECT_NAME}_testlib SHARED ${sources}) target_link_libraries(${PROJECT_NAME}_testlib ${COMMON_LIBRARIES}) - include(tests.CMakeLists.txt) + add_subdirectory(tests) endif() include(packages.CMakeLists.txt) diff --git a/tests.CMakeLists.txt b/tests/CMakeLists.txt similarity index 82% rename from tests.CMakeLists.txt rename to tests/CMakeLists.txt index 164eb2d..cd11df0 100644 --- a/tests.CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,10 +1,10 @@ include(CTest) -file(GLOB sources_tests tests/test_*.cpp) +file(GLOB sources_tests test_*.cpp) find_package(Catch2) if(Catch2_FOUND) # Catch 2.x include(Catch) - add_executable(all_tests tests/main.cpp ${sources_tests}) + add_executable(all_tests main.cpp ${sources_tests}) target_link_libraries(all_tests Catch2::Catch2 ${PROJECT_NAME}_testlib) target_include_directories(all_tests PRIVATE "/usr/include/catch2") catch_discover_tests(all_tests EXTRA_ARGS "${EXTRA_TEST_ARGS}") @@ -13,7 +13,7 @@ else() # Catch 1.x message(STATUS "Catch 1.x found.") foreach(src ${sources_tests}) get_filename_component(bin ${src} NAME_WE) - add_executable(${bin} tests/main.cpp ${src}) + add_executable(${bin} main.cpp ${src}) target_link_libraries(${bin} ${PROJECT_NAME}_testlib) add_test(${bin} ${bin} "${EXTRA_TEST_ARGS}") endforeach()