diff --git a/CMakeLists.txt b/CMakeLists.txt index 133d7a63e..d351589ed 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -313,17 +313,7 @@ list(APPEND EXTRA_LIBS "m") add_subdirectory(src) add_subdirectory(doc) -if(ENABLE_TESTS) - find_package(CppUTest) - if(CPPUTEST_FOUND) - enable_testing() - else() - message(SEND_ERROR "CppUTest not found") - endif() -else() - enable_testing() - add_test(NAME notests COMMAND true) -endif() +enable_testing() add_subdirectory(tests) configure_file(config.h.cmake config.h @ONLY) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 06e9d780b..37b07c5ff 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -25,4 +25,6 @@ endif() if(ENABLE_TESTS) add_subdirectory(unit) +else() + add_test(NAME notests COMMAND true) endif() diff --git a/tests/unit/CMakeLists.txt b/tests/unit/CMakeLists.txt index 2df393210..2966eda33 100644 --- a/tests/unit/CMakeLists.txt +++ b/tests/unit/CMakeLists.txt @@ -22,6 +22,8 @@ enable_language(CXX) remove_definitions(-DHAVE_CONFIG_H) + +find_package(CppUTest REQUIRED) include_directories( ${CPPUTEST_INCLUDE_DIRS} ${PROJECT_BINARY_DIR}