diff options
| author | Saleem Abdulrasol <compnerd@compnerd.org> | 2019-11-02 15:06:17 -0400 |
|---|---|---|
| committer | Saleem Abdulrasol <compnerd@compnerd.org> | 2019-11-02 15:07:54 -0400 |
| commit | 5ce2c6d2db88019e0b8bc00c77e4155b4eaa15d7 (patch) | |
| tree | 25dfb58539bcb879ecec0e00c9d2c92e38625ef7 | |
| parent | f722071a9ed9443be9f4847221341fc1d2fb229e (diff) | |
| download | bcm5719-llvm-5ce2c6d2db88019e0b8bc00c77e4155b4eaa15d7.tar.gz bcm5719-llvm-5ce2c6d2db88019e0b8bc00c77e4155b4eaa15d7.zip | |
build: avoid custom handling for C++ standard
Use the builtin CMake support for specifying the proper flags for the targets to
build at a certain C++ standard. This avoids unnecessary checks in CMake,
speeding up the configure phase as well as simplifies the logic overall.
| -rw-r--r-- | libcxx/CMakeLists.txt | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt index e57ed030a8d..cdb3b085cb0 100644 --- a/libcxx/CMakeLists.txt +++ b/libcxx/CMakeLists.txt @@ -518,21 +518,18 @@ remove_flags(-Wno-pedantic -pedantic-errors -pedantic) # Required flags ============================================================== function(cxx_add_basic_build_flags target) - if (LIBCXX_HAS_MUSL_LIBC OR LIBCXX_TARGETING_CLANG_CL) - # musl's pthread implementations uses volatile types in their structs which is - # not a constexpr in C++11 but is in C++14, so we use C++14 with musl. - set(LIBCXX_STANDARD_VER c++14 CACHE STRING "internal option to change build dialect") + if(LIBCXX_HAS_MUSL_LIBC OR LIBCXX_TARGETING_CLANG_CL) + # musl's pthread implementations uses volatile types in their structs which + # is not a constexpr in C++11 but is in C++14, so we use C++14 with musl. + set_target_properties(${target} PROPERTIES + CXX_STANDARD 14 + CXX_STANDARD_REQUIRED YES + CXX_EXTENSIONS NO) else() - set(LIBCXX_STANDARD_VER c++11 CACHE STRING "internal option to change build dialect") - endif() - target_add_compile_flags_if_supported(${target} PRIVATE -std=${LIBCXX_STANDARD_VER}) - target_add_compile_flags_if_supported(${target} PRIVATE "/std:${LIBCXX_STANDARD_VER}") - mangle_name("LIBCXX_SUPPORTS_STD_EQ_${LIBCXX_STANDARD_VER}_FLAG" SUPPORTS_DIALECT_NAME) - mangle_name("LIBCXX_SUPPORTS_STD_COLON_${LIBCXX_STANDARD_VER}_FLAG" SUPPORTS_DIALECT_NAME_MSVC) - if(NOT ${SUPPORTS_DIALECT_NAME} AND NOT ${SUPPORTS_DIALECT_NAME_MSVC}) - if(NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC" AND NOT "${CMAKE_CXX_SIMULATE_ID}" STREQUAL "MSVC") - message(FATAL_ERROR "C++11 or greater is required but the compiler does not support ${LIBCXX_STANDARD_VER}") - endif() + set_target_properties(${target} PROPERTIES + CXX_STANDARD 11 + CXX_STANDARD_REQUIRED YES + CXX_EXTENSIONS NO) endif() # On all systems the system c++ standard library headers need to be excluded. |

