cmake: Let make target 'test' be accessable from topmost build directory The cmake command enable_testing() must be placed in the topmost CMakeLists.txt so that the make target 'test' is available in the topmost build directory.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 321cfd1..ab20340 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -16,5 +16,6 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
add_subdirectory(src)
if (BUILD_TESTS)
- add_subdirectory(tests)
+ enable_testing()
+ add_subdirectory(tests)
endif()
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 25e9eea..be1c359 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -1,4 +1,3 @@
-enable_testing()
include_directories(../src)
add_library(testdll SHARED testdll.c)
set_target_properties(testdll PROPERTIES PREFIX "")