@@ -518,21 +518,18 @@ remove_flags(-Wno-pedantic -pedantic-errors -pedantic)
518
518
519
519
# Required flags ==============================================================
520
520
function (cxx_add_basic_build_flags target )
521
- if (LIBCXX_HAS_MUSL_LIBC OR LIBCXX_TARGETING_CLANG_CL )
522
- # musl's pthread implementations uses volatile types in their structs which is
523
- # not a constexpr in C++11 but is in C++14, so we use C++14 with musl.
524
- set (LIBCXX_STANDARD_VER c++14 CACHE STRING "internal option to change build dialect" )
521
+ if (LIBCXX_HAS_MUSL_LIBC OR LIBCXX_TARGETING_CLANG_CL )
522
+ # musl's pthread implementations uses volatile types in their structs which
523
+ # is not a constexpr in C++11 but is in C++14, so we use C++14 with musl.
524
+ set_target_properties (${target} PROPERTIES
525
+ CXX_STANDARD 14
526
+ CXX_STANDARD_REQUIRED YES
527
+ CXX_EXTENSIONS NO )
525
528
else ()
526
- set (LIBCXX_STANDARD_VER c++11 CACHE STRING "internal option to change build dialect" )
527
- endif ()
528
- target_add_compile_flags_if_supported (${target} PRIVATE -std=${LIBCXX_STANDARD_VER} )
529
- target_add_compile_flags_if_supported (${target} PRIVATE "/std:${LIBCXX_STANDARD_VER} " )
530
- mangle_name ("LIBCXX_SUPPORTS_STD_EQ_${LIBCXX_STANDARD_VER} _FLAG" SUPPORTS_DIALECT_NAME )
531
- mangle_name ("LIBCXX_SUPPORTS_STD_COLON_${LIBCXX_STANDARD_VER} _FLAG" SUPPORTS_DIALECT_NAME_MSVC )
532
- if (NOT ${SUPPORTS_DIALECT_NAME} AND NOT ${SUPPORTS_DIALECT_NAME_MSVC} )
533
- if (NOT "${CMAKE_CXX_COMPILER_ID} " STREQUAL "MSVC" AND NOT "${CMAKE_CXX_SIMULATE_ID} " STREQUAL "MSVC" )
534
- message (FATAL_ERROR "C++11 or greater is required but the compiler does not support ${LIBCXX_STANDARD_VER} " )
535
- endif ()
529
+ set_target_properties (${target} PROPERTIES
530
+ CXX_STANDARD 11
531
+ CXX_STANDARD_REQUIRED YES
532
+ CXX_EXTENSIONS NO )
536
533
endif ()
537
534
538
535
# On all systems the system c++ standard library headers need to be excluded.
0 commit comments