From: Justin Bogner Date: Tue, 9 Apr 2019 08:14:32 +0000 (+0000) Subject: [CMake] Move configuration of LLVM_CXX_STD to HandleLLVMOptions.cmake X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b935402f9a0f540e9daad0f822f7268a11382258;p=llvm [CMake] Move configuration of LLVM_CXX_STD to HandleLLVMOptions.cmake 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 --- diff --git a/CMakeLists.txt b/CMakeLists.txt index caecd0228ae..80d58d78a35 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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" ) diff --git a/cmake/modules/HandleLLVMOptions.cmake b/cmake/modules/HandleLLVMOptions.cmake index 66ccbbf5be6..47a111253bf 100644 --- a/cmake/modules/HandleLLVMOptions.cmake +++ b/cmake/modules/HandleLLVMOptions.cmake @@ -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)