summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2014-12-05 19:06:43 (GMT)
committerBrad King <brad.king@kitware.com>2014-12-05 19:07:59 (GMT)
commitde022e8908cc5b3a6e0f179a81482fad4cfb6072 (patch)
tree3cc8497c09b1e5ce0743d69dc4b83c43118504c9 /CMakeLists.txt
parentce28da6c64aba359b4399bca56ec60707a3d6073 (diff)
downloadCMake-de022e8908cc5b3a6e0f179a81482fad4cfb6072.zip
CMake-de022e8908cc5b3a6e0f179a81482fad4cfb6072.tar.gz
CMake-de022e8908cc5b3a6e0f179a81482fad4cfb6072.tar.bz2
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).
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt8
1 files changed, 6 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ad3bb97..1812b27 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)