]> granicus.if.org Git - llvm/commitdiff
[CMake] Move configuration of LLVM_CXX_STD to HandleLLVMOptions.cmake
authorJustin Bogner <mail@justinbogner.com>
Tue, 9 Apr 2019 08:14:32 +0000 (08:14 +0000)
committerJustin Bogner <mail@justinbogner.com>
Tue, 9 Apr 2019 08:14:32 +0000 (08:14 +0000)
Standalone builds of projects other than llvm itself (lldb, libcxx,
etc) include HandleLLVMOptions but not the top level llvm CMakeLists,
so we need to set this variable here to ensure that it always has a
value.

This should fix the build issues some folks have been seeing.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@357976 91177308-0d34-0410-b5e6-96231b3b80d8

CMakeLists.txt
cmake/modules/HandleLLVMOptions.cmake

index caecd0228ae088e7875b8feef534cf9b5f30c3c8..80d58d78a3538eb9617e0932201e886dacafee64 100644 (file)
@@ -426,16 +426,6 @@ option(LLVM_ENABLE_LLD "Use lld as C and C++ linker." OFF)
 option(LLVM_ENABLE_PEDANTIC "Compile with pedantic enabled." ON)
 option(LLVM_ENABLE_WERROR "Fail and stop if a warning is triggered." OFF)
 
-set(LLVM_CXX_STD_default "c++11")
-# Preserve behaviour of legacy cache variables
-if (LLVM_ENABLE_CXX1Y)
-  set(LLVM_CXX_STD_default "c++1y")
-elseif (LLVM_ENABLE_CXX1Z)
-  set(LLVM_CXX_STD_default "c++1z")
-endif()
-set(LLVM_CXX_STD ${LLVM_CXX_STD_default}
-    CACHE STRING "C++ standard to use for compilation.")
-
 option(LLVM_ENABLE_DUMP "Enable dump functions even when assertions are disabled" OFF)
 
 if( NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG" )
index 66ccbbf5be6359bfde1bab0232ad12ca96d2ed1a..47a111253bf686f0febb9b904a03c127e7d408e9 100644 (file)
@@ -18,6 +18,16 @@ else()
   set(LINKER_IS_LLD_LINK FALSE)
 endif()
 
+set(LLVM_CXX_STD_default "c++11")
+# Preserve behaviour of legacy cache variables
+if (LLVM_ENABLE_CXX1Y)
+  set(LLVM_CXX_STD_default "c++1y")
+elseif (LLVM_ENABLE_CXX1Z)
+  set(LLVM_CXX_STD_default "c++1z")
+endif()
+set(LLVM_CXX_STD ${LLVM_CXX_STD_default}
+    CACHE STRING "C++ standard to use for compilation.")
+
 set(LLVM_ENABLE_LTO OFF CACHE STRING "Build LLVM with LTO. May be specified as Thin or Full to use a particular kind of LTO")
 string(TOUPPER "${LLVM_ENABLE_LTO}" uppercase_LLVM_ENABLE_LTO)