changeset 69:fce7e41875db

CMake: add WITH_TESTS option
author David Demelier <markand@malikania.fr>
date Mon, 19 Dec 2016 12:58:53 +0100
parents 0a1e3bb3c629
children 58444cf5f227
files CMakeLists.txt cmake/MalikaniaOptions.cmake
diffstat 2 files changed, 14 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/CMakeLists.txt	Mon Dec 19 12:56:12 2016 +0100
+++ b/CMakeLists.txt	Mon Dec 19 12:58:53 2016 +0100
@@ -46,7 +46,6 @@
 )
 
 include_directories(${CMAKE_BINARY_DIR})
-enable_testing()
 
 find_package(Boost REQUIRED COMPONENTS filesystem system timer unit_test_framework)
 find_package(OpenSSL REQUIRED)
@@ -63,7 +62,11 @@
 add_subdirectory(libserver)
 add_subdirectory(client)
 add_subdirectory(server)
-add_subdirectory(tests)
+
+if (WITH_TESTS)
+    enable_testing()
+    add_subdirectory(tests)
+endif ()
 
 message("Building information:")
 message("      General flags:   ${CMAKE_CXX_FLAGS}")
@@ -72,4 +75,6 @@
 message("")
 message("Documentation:")
 message("      Doxygen:         ${WITH_DOXYGEN_MSG}")
+message("Additional options:")
 message("      Vera:            ${WITH_VERA_MSG}")
+message("      Tests:           ${WITH_TESTS_MSG}")
--- a/cmake/MalikaniaOptions.cmake	Mon Dec 19 12:56:12 2016 +0100
+++ b/cmake/MalikaniaOptions.cmake	Mon Dec 19 12:58:53 2016 +0100
@@ -73,6 +73,7 @@
 #
 
 option(WITH_VERA "Enable vera++ analyzer" On)
+option(WITH_TESTS "Enable unit tests" On)
 
 find_program(VERA_EXECUTABLE vera++)
 
@@ -87,6 +88,12 @@
     malikania_setg(WITH_VERA_MSG "No (disabled by user)")
 endif ()
 
+if (NOT WITH_TESTS)
+    malikania_setg(WITH_TESTS_MSG "No (disabled by user)")
+else ()
+    malikania_setg(WITH_TESTS_MSG "Yes")
+endif ()
+
 #
 # Options for unit tests
 # -------------------------------------------------------------------