about summary refs log tree commit diff homepage
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorDan Liew <daniel.liew@imperial.ac.uk>2017-01-18 13:54:30 +0000
committerDan Liew <daniel.liew@imperial.ac.uk>2017-01-18 13:54:30 +0000
commit19b7bdd916c484b52ce1237401b15a346575b4cf (patch)
tree6478c01fc41cc806e27ba7c5d9688bc2f45cbffa /CMakeLists.txt
parentb149dfa242753004d8fb00c4aa55e340d56c0d43 (diff)
downloadklee-19b7bdd916c484b52ce1237401b15a346575b4cf.tar.gz
[CMake] Remove `ENABLE_TESTS` CMake cache option.
The intention of this option was to provide a switch that can be
used to globally enable/disable tests.

This option ended up causing a lot of confusion as can be seen
on the discussion on writing documention for the new build system.

https://github.com/klee/klee.github.io/pull/53

So it was decided to remove this option. This fixes #568 .
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt54
1 files changed, 33 insertions, 21 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 80224283..97c51a2e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -672,9 +672,22 @@ add_subdirectory(tools)
 ################################################################################
 # Testing
 ################################################################################
-option(ENABLE_TESTS "Enable tests" ON)
+option(ENABLE_UNIT_TESTS "Enable unit tests" ON)
+option(ENABLE_SYSTEM_TESTS "Enable system tests" ON)
+
+# This provides a migration path for older build directories that have this
+# variable set in their cache. Leaving it behind could lead to confusion so
+# removing it is probably a good idea.
+# TODO: Remove this eventually (probably next release or something).
+if (DEFINED ENABLE_TESTS)
+  message(WARNING "You have the \"ENABLE_TESTS\" variable is your CMake cache."
+    "This variable no longer has any meaning so removing it from your cache")
+  unset(ENABLE_TESTS CACHE)
+endif()
+
+if (ENABLE_UNIT_TESTS OR ENABLE_SYSTEM_TESTS)
+  message(STATUS "Testing is enabled")
 
-if (ENABLE_TESTS)
   # Find lit
   set(LIT_TOOL_NAMES "llvm-lit" "lit")
   find_program(
@@ -691,11 +704,12 @@ if (ENABLE_TESTS)
     "Lit arguments"
   )
 
-if ((NOT LIT_TOOL) OR (NOT EXISTS "${LIT_TOOL}"))
+  if ((NOT LIT_TOOL) OR (NOT EXISTS "${LIT_TOOL}"))
     message(FATAL_ERROR "The lit tool is required for testing."
       " CMake tried to find lit with the following names \"${LIT_TOOL_NAMES}\""
       " but it could not be found.\n"
-      "You should either disable testing by passing \"-DENABLE_TESTS=OFF\" to cmake"
+      "You should either disable testing by passing "
+      "\"-DENABLE_UNIT_TESTS=OFF -DENABLE_SYSTEM_TESTS=OFF\" to cmake"
       " or you should install the lit tool from the Python Package Index by running"
       " \"pip install lit\". Note \"pip\" requires root privileges to run. If you"
       " don't have root privileges you can create a virtual python environment using"
@@ -708,26 +722,24 @@ if ((NOT LIT_TOOL) OR (NOT EXISTS "${LIT_TOOL}"))
   add_custom_target(check
     COMMENT "Running tests"
   )
+else()
+  message(STATUS "Testing is disabled")
+endif()
 
-  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()
-  option(ENABLE_SYSTEM_TESTS "Enable system tests" ON)
-  if (ENABLE_SYSTEM_TESTS)
-    message(STATUS "System tests enabled")
-    add_subdirectory(test)
-    add_dependencies(check systemtests)
-  else()
-    message(STATUS "System tests disabled")
-  endif()
 
+if (ENABLE_UNIT_TESTS)
+  message(STATUS "Unit tests enabled")
+  add_subdirectory(unittests)
+  add_dependencies(check unittests)
+else()
+  message(STATUS "Unit tests disabled")
+endif()
+if (ENABLE_SYSTEM_TESTS)
+  message(STATUS "System tests enabled")
+  add_subdirectory(test)
+  add_dependencies(check systemtests)
 else()
-  message(STATUS "Testing disabled")
+  message(STATUS "System tests disabled")
 endif()
 
 ################################################################################