summaryrefslogtreecommitdiffstats
path: root/Source/CMakeLists.txt
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2012-03-09 19:28:21 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2012-03-09 19:28:21 (GMT)
commitd40eebd89df7d0a9bfa12d12c7a11d61e8cfec1a (patch)
treed24ff847919041a6a052fef50031da99d241413d /Source/CMakeLists.txt
parent8c634330db7988c56d0327d60c8056460634974b (diff)
downloadCMake-d40eebd89df7d0a9bfa12d12c7a11d61e8cfec1a.zip
CMake-d40eebd89df7d0a9bfa12d12c7a11d61e8cfec1a.tar.gz
CMake-d40eebd89df7d0a9bfa12d12c7a11d61e8cfec1a.tar.bz2
Ninja: Add a cache option CMAKE_ENABLE_NINJA to enable the ninja generator.
Make the option default to on, for platforms where CMake passes all tests with the ninja generator. This is currently only Linux.
Diffstat (limited to 'Source/CMakeLists.txt')
-rw-r--r--Source/CMakeLists.txt17
1 files changed, 15 insertions, 2 deletions
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index eb4327c..18f9b8b 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -353,7 +353,18 @@ IF (WIN32)
ENDIF(NOT UNIX)
ENDIF (WIN32)
-if(NOT WIN32)
+# turn on Ninja by default
+set(_CMAKE_DEFAULT_NINJA_VALUE TRUE)
+# turn it off for platforms where it does not pass all the
+# tests
+if(WIN32 OR APPLE)
+ SET(_CMAKE_DEFAULT_NINJA_VALUE FALSE)
+endif()
+SET(CMAKE_ENABLE_NINJA ${_CMAKE_DEFAULT_NINJA_VALUE} CACHE BOOL
+ "Enable the ninja generator for CMake. currently not fully working for Windows or OSX")
+MARK_AS_ADVANCED(CMAKE_ENABLE_NINJA)
+IF(CMAKE_ENABLE_NINJA)
+ MESSAGE(STATUS "Enable ninja generator.")
SET(SRCS ${SRCS}
cmGlobalNinjaGenerator.cxx
cmGlobalNinjaGenerator.h
@@ -368,7 +379,9 @@ if(NOT WIN32)
cmNinjaUtilityTargetGenerator.h
)
ADD_DEFINITIONS(-DCMAKE_USE_NINJA)
-endif()
+ELSE()
+ MESSAGE(STATUS "Disable ninja generator.")
+ENDIF()
# create a library used by the command line and the GUI
ADD_LIBRARY(CMakeLib ${SRCS})