diff options
author | Saleem Abdulrasool <compnerd@compnerd.org> | 2019-10-25 10:57:52 -0700 |
---|---|---|
committer | Saleem Abdulrasool <compnerd@compnerd.org> | 2019-10-25 11:51:47 -0700 |
commit | 2724d9e12960cc1d93eeabbfc9aa1bffffa041cc (patch) | |
tree | 9897ed4b98787d8e33fdbede626169d5c90919aa /llvm | |
parent | 074af2daf5f33b884088dc0200b1acb038bfcaec (diff) | |
download | bcm5719-llvm-2724d9e12960cc1d93eeabbfc9aa1bffffa041cc.tar.gz bcm5719-llvm-2724d9e12960cc1d93eeabbfc9aa1bffffa041cc.zip |
build: remove `LLVM_CXX_STD` extension point
This extension point is not needed. Provide the equivalent option
through `CMAKE_CXX_STANDARD` which mirrors the previous extension point. Rely on
CMake to provide the check for the compiler instead.
Diffstat (limited to 'llvm')
-rw-r--r-- | llvm/CMakeLists.txt | 4 | ||||
-rw-r--r-- | llvm/cmake/modules/HandleLLVMOptions.cmake | 28 | ||||
-rw-r--r-- | llvm/docs/CMake.rst | 14 |
3 files changed, 15 insertions, 31 deletions
diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt index e4592283053..ec9050b9189 100644 --- a/llvm/CMakeLists.txt +++ b/llvm/CMakeLists.txt @@ -50,6 +50,10 @@ project(LLVM 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) diff --git a/llvm/cmake/modules/HandleLLVMOptions.cmake b/llvm/cmake/modules/HandleLLVMOptions.cmake index 75c2df9eb55..5aa72568c65 100644 --- a/llvm/cmake/modules/HandleLLVMOptions.cmake +++ b/llvm/cmake/modules/HandleLLVMOptions.cmake @@ -18,17 +18,6 @@ else() 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 @@ if ( LLVM_COMPILER_IS_GCC_COMPATIBLE OR CMAKE_CXX_COMPILER_ID MATCHES "XL" ) 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}) diff --git a/llvm/docs/CMake.rst b/llvm/docs/CMake.rst index ddc09ecf1db..eb8bc71e729 100644 --- a/llvm/docs/CMake.rst +++ b/llvm/docs/CMake.rst @@ -204,6 +204,17 @@ CMake manual, or execute ``cmake --help-variable VARIABLE_NAME``. **CMAKE_CXX_FLAGS**:STRING Extra flags to use when compiling C++ source files. +Rarely-used CMake variables +--------------------------- + +Here are some of the CMake variables that are rarely used, along with a brief +explanation and LLVM-specific notes. For full documentation, consult the CMake +manual, or execute ``cmake --help-variable VARIABLE_NAME``. + +**CMAKE_CXX_STANDARD**:STRING + Sets the C++ standard to conform to when building LLVM. Possible values are + 14, 17, 20. LLVM Requires C++ 14 or higher. This defaults to 14. + .. _LLVM-specific variables: LLVM-specific variables @@ -274,9 +285,6 @@ LLVM-specific variables 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*. |