1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 04:02:41 +01:00

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.
This commit is contained in:
Saleem Abdulrasool 2019-10-25 10:57:52 -07:00
parent 0acc35fd3b
commit f93757f9ac
3 changed files with 15 additions and 31 deletions

View File

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

View File

@ -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})

View File

@ -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*.