[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.

llvm-svn: 357976
This commit is contained in:
Justin Bogner 2019-04-09 08:14:32 +00:00
parent 9837f54843
commit c60d09597c
2 changed files with 10 additions and 10 deletions

View 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" )

View 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)