about summary refs log tree commit diff homepage
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorDan Liew <daniel.liew@imperial.ac.uk>2016-12-19 12:44:26 +0000
committerDan Liew <daniel.liew@imperial.ac.uk>2017-01-16 22:45:05 +0000
commit415232f18a08f5808bcf1582b374e0b7591c0c32 (patch)
treeda2d8c726142eda9e0553b35e8e17cd864175cf1 /CMakeLists.txt
parent01ba72697bc5476bfe486725c302bb2e0867076e (diff)
downloadklee-415232f18a08f5808bcf1582b374e0b7591c0c32.tar.gz
[CMake] Only add dependencies to `check` if the target is enabled.
Surprisingly the old code still worked even when the target didn't
exist.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt12
1 files changed, 7 insertions, 5 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7d392f18..11c7e81b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -699,10 +699,16 @@ if ((NOT LIT_TOOL) OR (NOT EXISTS "${LIT_TOOL}"))
     message(STATUS "Using lit: ${LIT_TOOL}")
   endif()
 
+  # Add global test target
+  add_custom_target(check
+    COMMENT "Running tests"
+  )
+
   option(ENABLE_UNIT_TESTS "Enable unit tests" ON)
   if (ENABLE_UNIT_TESTS)
     message(STATUS "Unit tests enabled")
     add_subdirectory(unittests)
+    add_dependencies(check unittests)
   else()
     message(STATUS "Unit tests disabled")
   endif()
@@ -710,15 +716,11 @@ if ((NOT LIT_TOOL) OR (NOT EXISTS "${LIT_TOOL}"))
   if (ENABLE_SYSTEM_TESTS)
     message(STATUS "System tests enabled")
     add_subdirectory(test)
+    add_dependencies(check systemtests)
   else()
     message(STATUS "System tests disabled")
   endif()
 
-  # Add global test target
-  add_custom_target(check
-    DEPENDS unittests systemtests
-    COMMENT "Running tests"
-  )
 else()
   message(STATUS "Testing disabled")
 endif()