Index: CMakeLists.txt =================================================================== --- CMakeLists.txt +++ CMakeLists.txt @@ -50,6 +50,10 @@ VERSION ${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH} LANGUAGES C CXX ASM) +set(CMAKE_CXX_STANDARD 14 CACHE STRING "C++ standard to conform to") +set(CMAKE_CXX_STANDARD_REQUIRED YES) +set(CMAKE_CXX_EXTENSIONS NO) + if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) message(STATUS "No build type selected, default to Debug") set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Build type (default Debug)" FORCE) Index: cmake/modules/HandleLLVMOptions.cmake =================================================================== --- cmake/modules/HandleLLVMOptions.cmake +++ cmake/modules/HandleLLVMOptions.cmake @@ -18,17 +18,6 @@ set(LINKER_IS_LLD_LINK FALSE) endif() -set(LLVM_CXX_STD_default "c++14") -# Preserve behaviour of legacy cache variables -if (LLVM_ENABLE_CXX1Z) - set(LLVM_CXX_STD_default "c++1z") -endif() -if (LLVM_CXX_STD STREQUAL "c++11") - set(LLVM_CXX_STD_force FORCE) -endif() -set(LLVM_CXX_STD ${LLVM_CXX_STD_default} - CACHE STRING "C++ standard to use for compilation." ${LLVM_CXX_STD_force}) - 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) @@ -445,23 +434,6 @@ add_flag_if_supported("-Werror=unguarded-availability-new" WERROR_UNGUARDED_AVAILABILITY_NEW) endif( LLVM_COMPILER_IS_GCC_COMPATIBLE OR CMAKE_CXX_COMPILER_ID MATCHES "XL" ) -# C++ language standard selection for compilers accepting the GCC-style option: -if ( LLVM_COMPILER_IS_GCC_COMPATIBLE OR CMAKE_CXX_COMPILER_ID MATCHES "XL" ) - check_cxx_compiler_flag("-std=${LLVM_CXX_STD}" CXX_SUPPORTS_CXX_STD) - if (CXX_SUPPORTS_CXX_STD) - if (CYGWIN OR MINGW) - # MinGW and Cygwin are a bit stricter and lack things like - # 'strdup', 'stricmp', etc in c++11 mode. - string(REPLACE "c++" "gnu++" gnu_LLVM_CXX_STD "${LLVM_CXX_STD}") - append("-std=${gnu_LLVM_CXX_STD}" CMAKE_CXX_FLAGS) - else() - append("-std=${LLVM_CXX_STD}" CMAKE_CXX_FLAGS) - endif() - else() - message(FATAL_ERROR "The host compiler does not support '-std=${LLVM_CXX_STD}'.") - endif() -endif( LLVM_COMPILER_IS_GCC_COMPATIBLE OR CMAKE_CXX_COMPILER_ID MATCHES "XL" ) - # Modules enablement for GCC-compatible compilers: if ( LLVM_COMPILER_IS_GCC_COMPATIBLE AND LLVM_ENABLE_MODULES ) set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) Index: docs/CMake.rst =================================================================== --- docs/CMake.rst +++ docs/CMake.rst @@ -274,9 +274,6 @@ Enable unwind tables in the binary. Disabling unwind tables can reduce the size of the libraries. Defaults to ON. -**LLVM_CXX_STD**:STRING - Build with the specified C++ standard. Defaults to "c++11". - **LLVM_ENABLE_ASSERTIONS**:BOOL Enables code assertions. Defaults to ON if and only if ``CMAKE_BUILD_TYPE`` is *Debug*.