diff --git a/CMakeLists.txt b/CMakeLists.txt
index 06c50a1cd5c711fe2451695d6216095fbe811c66..54547c3a7fa959d477c39c12e389eac476c1ada0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -6,8 +6,10 @@ add_definitions ("-D_GNU_SOURCE")
 
 set(CMAKE_C_FLAGS "-std=c11 -Wall -Wextra")
 
-enable_testing()
+if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/test/libdap-test/CMakeLists.txt")
+    enable_testing()
+    add_subdirectory(test)
+endif()
 
 add_subdirectory(core)
 add_subdirectory(crypto)
-add_subdirectory(test)