summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2014-12-05 14:06:43 -0500
committerBrad King <brad.king@kitware.com>2014-12-05 14:07:59 -0500
commitde022e8908cc5b3a6e0f179a81482fad4cfb6072 (patch)
tree3cc8497c09b1e5ce0743d69dc4b83c43118504c9
parentce28da6c64aba359b4399bca56ec60707a3d6073 (diff)
downloadcmake-de022e8908cc5b3a6e0f179a81482fad4cfb6072.tar.gz
Add options to build CMake without latest language dialects
Set CMAKE_C_STANDARD and CMAKE_CXX_STANDARD only if they are not already defined. This will allow users to add the settings with different values to their local cache (e.g. on the command line).
-rw-r--r--CMakeLists.txt8
1 files changed, 6 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ad3bb97344..1812b2773d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -37,8 +37,12 @@ if("${CMake_SOURCE_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")
endif()
# Use most-recent available language dialects with GNU and Clang
-set(CMAKE_C_STANDARD 11)
-set(CMAKE_CXX_STANDARD 14)
+if(NOT DEFINED CMAKE_C_STANDARD)
+ set(CMAKE_C_STANDARD 11)
+endif()
+if(NOT DEFINED CMAKE_CXX_STANDARD)
+ set(CMAKE_CXX_STANDARD 14)
+endif()
# option to set the internal encoding of CMake to UTF-8
option(CMAKE_ENCODING_UTF8 "Use UTF-8 encoding internally (experimental)." OFF)