summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2016-09-29 13:29:32 -0400
committerBrad King <brad.king@kitware.com>2016-09-29 13:38:47 -0400
commit6b97a5efc6c41a440ed5d9eb5ba9aed834d0bd40 (patch)
treeba349171e73f2e3e0a3688af9f2bef5e3c6c4443 /CMakeLists.txt
parenta8334961997767ecc31333b52537aa5e5b6c561c (diff)
downloadcmake-6b97a5efc6c41a440ed5d9eb5ba9aed834d0bd40.tar.gz
server-mode: Add option to enable/disable the mode explicitly
Provide a way for scripts building CMake to enable server mode explicitly and assume the risk of a build failure if it is not supported. This will allow such scripts to ensure that server mode is available if the build succeeds. It also allows scripts to explicitly disable server mode even if it would be supported.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt22
1 files changed, 16 insertions, 6 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6a26858fc1..f39ddf3437 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -695,15 +695,25 @@ endif()
CMAKE_SETUP_TESTING()
# Check whether to build server mode or not:
-set(CMake_ENABLE_SERVER_MODE 0)
-if(NOT CMake_TEST_EXTERNAL_CMAKE AND CMAKE_USE_LIBUV)
- list(FIND CMAKE_CXX_COMPILE_FEATURES cxx_auto_type CMake_HAVE_CXX_AUTO_TYPE)
- list(FIND CMAKE_CXX_COMPILE_FEATURES cxx_range_for CMake_HAVE_CXX_RANGE_FOR)
- if(CMake_HAVE_CXX_AUTO_TYPE AND CMake_HAVE_CXX_RANGE_FOR)
- if(CMake_HAVE_CXX_MAKE_UNIQUE)
+if(NOT CMake_TEST_EXTERNAL_CMAKE)
+ if(NOT DEFINED CMake_ENABLE_SERVER_MODE)
+ list(FIND CMAKE_CXX_COMPILE_FEATURES cxx_auto_type CMake_HAVE_CXX_AUTO_TYPE)
+ list(FIND CMAKE_CXX_COMPILE_FEATURES cxx_range_for CMake_HAVE_CXX_RANGE_FOR)
+ if(CMAKE_USE_LIBUV
+ AND CMake_HAVE_CXX_AUTO_TYPE
+ AND CMake_HAVE_CXX_MAKE_UNIQUE
+ AND CMake_HAVE_CXX_RANGE_FOR
+ )
set(CMake_ENABLE_SERVER_MODE 1)
+ else()
+ set(CMake_ENABLE_SERVER_MODE 0)
endif()
endif()
+ if(CMake_ENABLE_SERVER_MODE AND NOT CMAKE_USE_LIBUV)
+ message(FATAL_ERROR "The server mode requires libuv!")
+ endif()
+else()
+ set(CMake_ENABLE_SERVER_MODE 0)
endif()
if(NOT CMake_TEST_EXTERNAL_CMAKE)