diff options
Diffstat (limited to 'Modules/Compiler')
-rw-r--r-- | Modules/Compiler/AppleClang-C.cmake | 10 | ||||
-rw-r--r-- | Modules/Compiler/AppleClang-CXX.cmake | 10 | ||||
-rw-r--r-- | Modules/Compiler/Clang-C.cmake | 10 | ||||
-rw-r--r-- | Modules/Compiler/Clang-CXX.cmake | 10 | ||||
-rw-r--r-- | Modules/Compiler/GNU-C.cmake | 10 | ||||
-rw-r--r-- | Modules/Compiler/GNU-CXX.cmake | 10 | ||||
-rw-r--r-- | Modules/Compiler/Intel-C-FeatureTests.cmake | 9 | ||||
-rw-r--r-- | Modules/Compiler/Intel-C.cmake | 13 | ||||
-rw-r--r-- | Modules/Compiler/Intel-CXX-FeatureTests.cmake | 67 | ||||
-rw-r--r-- | Modules/Compiler/Intel-CXX.cmake | 50 | ||||
-rw-r--r-- | Modules/Compiler/MSVC-CXX.cmake | 9 | ||||
-rw-r--r-- | Modules/Compiler/SunPro-CXX.cmake | 10 |
12 files changed, 107 insertions, 111 deletions
diff --git a/Modules/Compiler/AppleClang-C.cmake b/Modules/Compiler/AppleClang-C.cmake index 1cc72c0..fe39b3b 100644 --- a/Modules/Compiler/AppleClang-C.cmake +++ b/Modules/Compiler/AppleClang-C.cmake @@ -25,18 +25,14 @@ if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.0) endif() macro(cmake_record_c_compile_features) - macro(_get_appleclang_features std_version list) - record_compiler_features(C "${std_version}" ${list}) - endmacro() - set(_result 0) if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.0) - _get_appleclang_features(${CMAKE_C11_STANDARD_COMPILE_OPTION} CMAKE_C11_COMPILE_FEATURES) + _record_compiler_features_c(11) if (_result EQUAL 0) - _get_appleclang_features(${CMAKE_C99_STANDARD_COMPILE_OPTION} CMAKE_C99_COMPILE_FEATURES) + _record_compiler_features_c(99) endif() if (_result EQUAL 0) - _get_appleclang_features(${CMAKE_C90_STANDARD_COMPILE_OPTION} CMAKE_C90_COMPILE_FEATURES) + _record_compiler_features_c(90) endif() endif() endmacro() diff --git a/Modules/Compiler/AppleClang-CXX.cmake b/Modules/Compiler/AppleClang-CXX.cmake index 95bc79a..8dd6278 100644 --- a/Modules/Compiler/AppleClang-CXX.cmake +++ b/Modules/Compiler/AppleClang-CXX.cmake @@ -36,21 +36,17 @@ endif() macro(cmake_record_cxx_compile_features) - macro(_get_appleclang_features std_version list) - record_compiler_features(CXX "${std_version}" ${list}) - endmacro() - set(_result 0) if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.0) set(_result 0) if(CMAKE_CXX14_STANDARD_COMPILE_OPTION) - _get_appleclang_features(${CMAKE_CXX14_STANDARD_COMPILE_OPTION} CMAKE_CXX14_COMPILE_FEATURES) + _record_compiler_features_cxx(14) endif() if (_result EQUAL 0) - _get_appleclang_features(${CMAKE_CXX11_STANDARD_COMPILE_OPTION} CMAKE_CXX11_COMPILE_FEATURES) + _record_compiler_features_cxx(11) endif() if (_result EQUAL 0) - _get_appleclang_features(${CMAKE_CXX98_STANDARD_COMPILE_OPTION} CMAKE_CXX98_COMPILE_FEATURES) + _record_compiler_features_cxx(98) endif() endif() endmacro() diff --git a/Modules/Compiler/Clang-C.cmake b/Modules/Compiler/Clang-C.cmake index d8b7743..b3f3805 100644 --- a/Modules/Compiler/Clang-C.cmake +++ b/Modules/Compiler/Clang-C.cmake @@ -34,18 +34,14 @@ if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.4) endif() macro(cmake_record_c_compile_features) - macro(_get_clang_features std_version list) - record_compiler_features(C "${std_version}" ${list}) - endmacro() - set(_result 0) if (UNIX AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.4) - _get_clang_features(${CMAKE_C11_STANDARD_COMPILE_OPTION} CMAKE_C11_COMPILE_FEATURES) + _record_compiler_features_c(11) if (_result EQUAL 0) - _get_clang_features(${CMAKE_C99_STANDARD_COMPILE_OPTION} CMAKE_C99_COMPILE_FEATURES) + _record_compiler_features_c(99) endif() if (_result EQUAL 0) - _get_clang_features(${CMAKE_C90_STANDARD_COMPILE_OPTION} CMAKE_C90_COMPILE_FEATURES) + _record_compiler_features_c(90) endif() endif() endmacro() diff --git a/Modules/Compiler/Clang-CXX.cmake b/Modules/Compiler/Clang-CXX.cmake index dc62711..dfe0628 100644 --- a/Modules/Compiler/Clang-CXX.cmake +++ b/Modules/Compiler/Clang-CXX.cmake @@ -44,18 +44,14 @@ if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.4) endif() macro(cmake_record_cxx_compile_features) - macro(_get_clang_features std_version list) - record_compiler_features(CXX "${std_version}" ${list}) - endmacro() - set(_result 0) if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.4) - _get_clang_features(${CMAKE_CXX14_STANDARD_COMPILE_OPTION} CMAKE_CXX14_COMPILE_FEATURES) + _record_compiler_features_cxx(14) if (_result EQUAL 0) - _get_clang_features(${CMAKE_CXX11_STANDARD_COMPILE_OPTION} CMAKE_CXX11_COMPILE_FEATURES) + _record_compiler_features_cxx(11) endif() if (_result EQUAL 0) - _get_clang_features(${CMAKE_CXX98_STANDARD_COMPILE_OPTION} CMAKE_CXX98_COMPILE_FEATURES) + _record_compiler_features_cxx(98) endif() endif() endmacro() diff --git a/Modules/Compiler/GNU-C.cmake b/Modules/Compiler/GNU-C.cmake index 2c478da..4dbf6ef 100644 --- a/Modules/Compiler/GNU-C.cmake +++ b/Modules/Compiler/GNU-C.cmake @@ -40,20 +40,16 @@ endif() macro(cmake_record_c_compile_features) - macro(_get_gcc_features std_version list) - record_compiler_features(C "${std_version}" ${list}) - endmacro() - set(_result 0) if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.6) - _get_gcc_features(${CMAKE_C11_STANDARD_COMPILE_OPTION} CMAKE_C11_COMPILE_FEATURES) + _record_compiler_features_c(11) endif() if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.4) if (_result EQUAL 0) - _get_gcc_features(${CMAKE_C99_STANDARD_COMPILE_OPTION} CMAKE_C99_COMPILE_FEATURES) + _record_compiler_features_c(99) endif() if (_result EQUAL 0) - _get_gcc_features(${CMAKE_C90_STANDARD_COMPILE_OPTION} CMAKE_C90_COMPILE_FEATURES) + _record_compiler_features_c(90) endif() endif() endmacro() diff --git a/Modules/Compiler/GNU-CXX.cmake b/Modules/Compiler/GNU-CXX.cmake index e1c555b..936f62b 100644 --- a/Modules/Compiler/GNU-CXX.cmake +++ b/Modules/Compiler/GNU-CXX.cmake @@ -47,20 +47,16 @@ if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.4) endif() macro(cmake_record_cxx_compile_features) - macro(_get_gcc_features std_version list) - record_compiler_features(CXX "${std_version}" ${list}) - endmacro() - set(_result 0) if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8) - _get_gcc_features(${CMAKE_CXX14_STANDARD_COMPILE_OPTION} CMAKE_CXX14_COMPILE_FEATURES) + _record_compiler_features_cxx(14) endif() if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.4) if (_result EQUAL 0) - _get_gcc_features(${CMAKE_CXX11_STANDARD_COMPILE_OPTION} CMAKE_CXX11_COMPILE_FEATURES) + _record_compiler_features_cxx(11) endif() if (_result EQUAL 0) - _get_gcc_features(${CMAKE_CXX98_STANDARD_COMPILE_OPTION} CMAKE_CXX98_COMPILE_FEATURES) + _record_compiler_features_cxx(98) endif() endif() endmacro() diff --git a/Modules/Compiler/Intel-C-FeatureTests.cmake b/Modules/Compiler/Intel-C-FeatureTests.cmake index 34175c8..5d09767 100644 --- a/Modules/Compiler/Intel-C-FeatureTests.cmake +++ b/Modules/Compiler/Intel-C-FeatureTests.cmake @@ -3,15 +3,11 @@ # - https://software.intel.com/en-us/articles/c99-support-in-intel-c-compiler # - https://software.intel.com/en-us/articles/c11-support-in-intel-c-compiler -# FIXME: Intel C feature detection works only when simulating the GNU compiler. -if("x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC") - return() -endif() - set(DETECT_C99 "defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L") +set(DETECT_C11 "defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L") #static assert is only around in version 1500 update 2 and above -set(_cmake_feature_test_c_static_assert "(__INTEL_COMPILER > 1500 || (__INTEL_COMPILER == 1500 && __INTEL_COMPILER_UPDATE > 1) ) && ${DETECT_C99}") +set(_cmake_feature_test_c_static_assert "(__INTEL_COMPILER > 1500 || (__INTEL_COMPILER == 1500 && __INTEL_COMPILER_UPDATE > 1) ) && (${DETECT_C11} || ${DETECT_C99} && !defined(_MSC_VER))") set(_cmake_oldestSupported "__INTEL_COMPILER >= 1110") set(Intel_C99 "${_cmake_oldestSupported} && ${DETECT_C99}") @@ -21,3 +17,4 @@ set(_cmake_feature_test_c_function_prototypes "${_cmake_oldestSupported}") unset(Intel_C99) unset(DETECT_C99) +unset(DETECT_C11) diff --git a/Modules/Compiler/Intel-C.cmake b/Modules/Compiler/Intel-C.cmake index 61adf40..5a79452 100644 --- a/Modules/Compiler/Intel-C.cmake +++ b/Modules/Compiler/Intel-C.cmake @@ -47,21 +47,16 @@ unset(_std) unset(_ext) macro(cmake_record_c_compile_features) - macro(_get_intel_c_features std_version list) - record_compiler_features(C "${std_version}" ${list}) - endmacro() - set(_result 0) - if (NOT "x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC" AND - NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 12.1) + if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 12.1) if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 15.0.0) - _get_intel_c_features(${CMAKE_C11_STANDARD_COMPILE_OPTION} CMAKE_C11_COMPILE_FEATURES) + _record_compiler_features_C(11) endif() if (_result EQUAL 0) - _get_intel_c_features(${CMAKE_C99_STANDARD_COMPILE_OPTION} CMAKE_C99_COMPILE_FEATURES) + _record_compiler_features_C(99) endif() if (_result EQUAL 0) - _get_intel_c_features(${CMAKE_C90_STANDARD_COMPILE_OPTION} CMAKE_C90_COMPILE_FEATURES) + _record_compiler_features_C(90) endif() endif() endmacro() diff --git a/Modules/Compiler/Intel-CXX-FeatureTests.cmake b/Modules/Compiler/Intel-CXX-FeatureTests.cmake index 57a05c8..e370647 100644 --- a/Modules/Compiler/Intel-CXX-FeatureTests.cmake +++ b/Modules/Compiler/Intel-CXX-FeatureTests.cmake @@ -3,11 +3,14 @@ # - https://software.intel.com/en-us/articles/c14-features-supported-by-intel-c-compiler # - http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0096r3.html -# FIXME: Intel C++ feature detection works only when simulating the GNU compiler. -# When simulating MSVC, Intel always sets __cplusplus to 199711L. -if("x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC") - return() -endif() +# Notes: +# [1] Some Intel versions define some feature macros under -std=gnu++98 +# that do not work in that mode (or work with warnings): +# - __cpp_attributes 200809 +# - __cpp_init_captures 201304 +# - __cpp_lambdas 200907 +# - __cpp_rvalue_references 200610 +# - __cpp_variadic_templates 200704 set(_cmake_feature_test_cxx_variable_templates "__cpp_variable_templates >= 201304") set(_cmake_feature_test_cxx_relaxed_constexpr "__cpp_constexpr >= 201304") @@ -18,44 +21,50 @@ set(DETECT_CXX11 "((__cplusplus >= 201103L) || defined(__INTEL_CXX11_MODE__) || #if you are compiling as 98/11/14. So to properly detect C++14 with this version #we look for the existence of __GXX_EXPERIMENTAL_CXX0X__ but not __INTEL_CXX11_MODE__ set(DETECT_BUGGY_ICC15 "((__INTEL_COMPILER == 1500) && (__INTEL_COMPILER_UPDATE == 1))") -set(DETECT_CXX14 "((__cplusplus >= 201300L) || ((__cplusplus == 201103L) && !defined(__INTEL_CXX11_MODE__)) || ((${DETECT_BUGGY_ICC15}) && defined(__GXX_EXPERIMENTAL_CXX0X__) && !defined(__INTEL_CXX11_MODE__) ) )") +set(DETECT_CXX14 "((__cplusplus >= 201300L) || ((__cplusplus == 201103L) && !defined(__INTEL_CXX11_MODE__)) || ((${DETECT_BUGGY_ICC15}) && defined(__GXX_EXPERIMENTAL_CXX0X__) && !defined(__INTEL_CXX11_MODE__) ) || (defined(__INTEL_CXX11_MODE__) && defined(__cpp_aggregate_nsdmi)) )") +unset(DETECT_BUGGY_ICC15) set(Intel16_CXX14 "__INTEL_COMPILER >= 1600 && ${DETECT_CXX14}") set(_cmake_feature_test_cxx_aggregate_default_initializers "${Intel16_CXX14}") set(_cmake_feature_test_cxx_contextual_conversions "${Intel16_CXX14}") -set(_cmake_feature_test_cxx_generic_lambdas "${Intel16_CXX14}") +set(_cmake_feature_test_cxx_generic_lambdas "__cpp_generic_lambdas >= 201304") set(_cmake_feature_test_cxx_digit_separators "${Intel16_CXX14}") # This test is supposed to work in Intel 14 but the compiler has a bug # in versions 14 and 15:: # https://software.intel.com/en-us/forums/intel-c-compiler/topic/600514 -# It also appears to fail with an internal compiler error on Intel 16. +# It also appears to fail with an internal compiler error on Intel 16 and 17. #set(_cmake_feature_test_cxx_generalized_initializers "${Intel16_CXX14}") +unset(Intel16_CXX14) -set(Intel15_CXX14 "__INTEL_COMPILER >= 1500 && ${DETECT_CXX14}") -set(_cmake_feature_test_cxx_decltype_auto "${Intel15_CXX14}") -set(_cmake_feature_test_cxx_lambda_init_captures "${Intel15_CXX14}") +set(Intel15 "__INTEL_COMPILER >= 1500") +set(Intel15_CXX14 "${Intel15} && ${DETECT_CXX14}") +set(_cmake_feature_test_cxx_decltype_auto "__cpp_decltype_auto >= 201304 || ${Intel15_CXX14}") +set(_cmake_feature_test_cxx_lambda_init_captures "(__cpp_init_captures >= 201304 || ${Intel15}) && ${DETECT_CXX14}") # [1] set(_cmake_feature_test_cxx_attribute_deprecated "${Intel15_CXX14}") -set(_cmake_feature_test_cxx_return_type_deduction "${Intel15_CXX14}") +set(_cmake_feature_test_cxx_return_type_deduction "__cpp_return_type_deduction >= 201304 || ${Intel15_CXX14}") +unset(Intel15_CXX14) +unset(Intel15) set(Intel15_CXX11 "__INTEL_COMPILER >= 1500 && ${DETECT_CXX11}") set(_cmake_feature_test_cxx_alignas "${Intel15_CXX11}") set(_cmake_feature_test_cxx_alignof "${Intel15_CXX11}") set(_cmake_feature_test_cxx_inheriting_constructors "${Intel15_CXX11}") -set(_cmake_feature_test_cxx_user_literals "${Intel15_CXX11}") +set(_cmake_feature_test_cxx_user_literals "__cpp_user_defined_literals >= 200809 || (${Intel15_CXX11} && (!defined(_MSC_VER) || __INTEL_COMPILER >= 1600))") set(_cmake_feature_test_cxx_thread_local "${Intel15_CXX11}") +unset(Intel15_CXX11) set(Intel14_CXX11 "${DETECT_CXX11} && (__INTEL_COMPILER > 1400 || (__INTEL_COMPILER == 1400 && __INTEL_COMPILER_UPDATE >= 2))") # Documented as 12.0+ but in testing it only works on 14.0.2+ -set(_cmake_feature_test_cxx_decltype_incomplete_return_types "${Intel14_CXX11}") +set(_cmake_feature_test_cxx_decltype_incomplete_return_types "${Intel14_CXX11} && !defined(_MSC_VER)") set(Intel14_CXX11 "__INTEL_COMPILER >= 1400 && ${DETECT_CXX11}") set(_cmake_feature_test_cxx_delegating_constructors "${Intel14_CXX11}") -set(_cmake_feature_test_cxx_constexpr "${Intel14_CXX11}") +set(_cmake_feature_test_cxx_constexpr "__cpp_constexpr >= 200704 || ${Intel14_CXX11}") set(_cmake_feature_test_cxx_sizeof_member "${Intel14_CXX11}") set(_cmake_feature_test_cxx_strong_enums "${Intel14_CXX11}") set(_cmake_feature_test_cxx_reference_qualified_functions "${Intel14_CXX11}") -set(_cmake_feature_test_cxx_raw_string_literals "${Intel14_CXX11}") -set(_cmake_feature_test_cxx_unicode_literals "${Intel14_CXX11}") +set(_cmake_feature_test_cxx_raw_string_literals "__cpp_raw_strings >= 200710 || ${Intel14_CXX11}") +set(_cmake_feature_test_cxx_unicode_literals "__cpp_unicode_literals >= 200710 || (${Intel14_CXX11} && (!defined(_MSC_VER) || __INTEL_COMPILER >= 1600))") set(_cmake_feature_test_cxx_inline_namespaces "${Intel14_CXX11}") set(_cmake_feature_test_cxx_unrestricted_unions "${Intel14_CXX11}") set(_cmake_feature_test_cxx_nonstatic_member_init "${Intel14_CXX11}") @@ -64,29 +73,32 @@ set(_cmake_feature_test_cxx_override "${Intel14_CXX11}") set(_cmake_feature_test_cxx_final "${Intel14_CXX11}") set(_cmake_feature_test_cxx_noexcept "${Intel14_CXX11}") set(_cmake_feature_test_cxx_defaulted_move_initializers "${Intel14_CXX11}") +unset(Intel14_CXX11) set(Intel13_CXX11 "__INTEL_COMPILER >= 1300 && ${DETECT_CXX11}") set(_cmake_feature_test_cxx_explicit_conversions "${Intel13_CXX11}") set(_cmake_feature_test_cxx_range_for "${Intel13_CXX11}") # Cannot find Intel documentation for N2640: cxx_uniform_initialization set(_cmake_feature_test_cxx_uniform_initialization "${Intel13_CXX11}") +unset(Intel13_CXX11) -set(Intel121_CXX11 "${_cmake_oldestSupported} && ${DETECT_CXX11}") -set(_cmake_feature_test_cxx_variadic_templates "${Intel121_CXX11}") +set(Intel121 "${_cmake_oldestSupported}") +set(Intel121_CXX11 "${Intel121} && ${DETECT_CXX11}") +set(_cmake_feature_test_cxx_variadic_templates "(__cpp_variadic_templates >= 200704 || ${Intel121}) && ${DETECT_CXX11}") # [1] set(_cmake_feature_test_cxx_alias_templates "${Intel121_CXX11}") set(_cmake_feature_test_cxx_nullptr "${Intel121_CXX11}") set(_cmake_feature_test_cxx_trailing_return_types "${Intel121_CXX11}") -set(_cmake_feature_test_cxx_attributes "${Intel121_CXX11}") +set(_cmake_feature_test_cxx_attributes "(__cpp_attributes >= 200809 || ${Intel121}) && ${DETECT_CXX11}") # [1] set(_cmake_feature_test_cxx_default_function_template_args "${Intel121_CXX11}") set(_cmake_feature_test_cxx_extended_friend_declarations "${Intel121_CXX11}") -set(_cmake_feature_test_cxx_rvalue_references "${Intel121_CXX11}") -set(_cmake_feature_test_cxx_decltype "${Intel121_CXX11}") +set(_cmake_feature_test_cxx_rvalue_references "(__cpp_rvalue_references >= 200610 || ${Intel121}) && ${DETECT_CXX11}") # [1] +set(_cmake_feature_test_cxx_decltype "__cpp_decltype >= 200707 || ${Intel121_CXX11}") set(_cmake_feature_test_cxx_defaulted_functions "${Intel121_CXX11}") set(_cmake_feature_test_cxx_deleted_functions "${Intel121_CXX11}") set(_cmake_feature_test_cxx_local_type_template_args "${Intel121_CXX11}") -set(_cmake_feature_test_cxx_lambdas "${Intel121_CXX11}") -set(_cmake_feature_test_cxx_binary_literals "${Intel121_CXX11}") -set(_cmake_feature_test_cxx_static_assert "${Intel121_CXX11}") +set(_cmake_feature_test_cxx_lambdas "(__cpp_lambdas >= 200907 || ${Intel121}) && ${DETECT_CXX11}") # [1] +set(_cmake_feature_test_cxx_binary_literals "__cpp_binary_literals >= 201304 || ${Intel121}") +set(_cmake_feature_test_cxx_static_assert "(__cpp_static_assert >= 200410 || ${Intel121}) && ${DETECT_CXX11}") set(_cmake_feature_test_cxx_right_angle_brackets "${Intel121_CXX11}") set(_cmake_feature_test_cxx_auto_type "${Intel121_CXX11}") set(_cmake_feature_test_cxx_extern_templates "${Intel121_CXX11}") @@ -94,3 +106,8 @@ set(_cmake_feature_test_cxx_variadic_macros "${Intel121_CXX11}") set(_cmake_feature_test_cxx_long_long_type "${Intel121_CXX11}") set(_cmake_feature_test_cxx_func_identifier "${Intel121_CXX11}") set(_cmake_feature_test_cxx_template_template_parameters "${Intel121_CXX11}") +unset(Intel121_CXX11) +unset(Intel121) + +unset(DETECT_CXX11) +unset(DETECT_CXX14) diff --git a/Modules/Compiler/Intel-CXX.cmake b/Modules/Compiler/Intel-CXX.cmake index 73dd7fa..d01d38d 100644 --- a/Modules/Compiler/Intel-CXX.cmake +++ b/Modules/Compiler/Intel-CXX.cmake @@ -10,19 +10,23 @@ set(CMAKE_DEPFILE_FLAGS_CXX "-MD -MT <OBJECT> -MF <DEPFILE>") if("x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC") set(_std -Qstd) set(_ext c++) + if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 16.0) + set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-Qstd=c++14") + # todo: there is no gnu++14 value supported; figure out what to do + set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-Qstd=c++14") + endif() else() set(_std -std) set(_ext gnu++) -endif() - -if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 15.0.2) - set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "${_std}=c++14") - # todo: there is no gnu++14 value supported; figure out what to do - set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "${_std}=c++14") -elseif (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 15.0.0) - set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "${_std}=c++1y") - # todo: there is no gnu++14 value supported; figure out what to do - set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "${_std}=c++1y") + if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 15.0.2) + set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++14") + # todo: there is no gnu++14 value supported; figure out what to do + set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=c++14") + elseif (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 15.0.0) + set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++1y") + # todo: there is no gnu++14 value supported; figure out what to do + set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=c++1y") + endif() endif() if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 13.0) @@ -34,8 +38,13 @@ elseif (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12.1) endif() if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12.1) - set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "${_std}=c++98") - set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "${_std}=${_ext}98") + if("x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC") + set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "") + set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "") + else() + set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "${_std}=c++98") + set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "${_std}=gnu++98") + endif() endif() if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12.1) @@ -55,21 +64,18 @@ unset(_std) unset(_ext) macro(cmake_record_cxx_compile_features) - macro(_get_intel_features std_version list) - record_compiler_features(CXX "${std_version}" ${list}) - endmacro() - set(_result 0) - if(NOT "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC" AND - NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12.1) - if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 15.0) - _get_intel_features(${CMAKE_CXX14_STANDARD_COMPILE_OPTION} CMAKE_CXX14_COMPILE_FEATURES) + if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12.1) + if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 16.0 + OR (NOT "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC" AND + NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 15.0)) + _record_compiler_features_cxx(14) endif() if (_result EQUAL 0) - _get_intel_features(${CMAKE_CXX11_STANDARD_COMPILE_OPTION} CMAKE_CXX11_COMPILE_FEATURES) + _record_compiler_features_cxx(11) endif() if (_result EQUAL 0) - _get_intel_features(${CMAKE_CXX98_STANDARD_COMPILE_OPTION} CMAKE_CXX98_COMPILE_FEATURES) + _record_compiler_features_cxx(98) endif() endif() endmacro() diff --git a/Modules/Compiler/MSVC-CXX.cmake b/Modules/Compiler/MSVC-CXX.cmake index 82ce069..f103832 100644 --- a/Modules/Compiler/MSVC-CXX.cmake +++ b/Modules/Compiler/MSVC-CXX.cmake @@ -5,5 +5,12 @@ if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 16.0) endif() macro(cmake_record_cxx_compile_features) - record_compiler_features(CXX "" CMAKE_CXX_COMPILE_FEATURES) + if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 16.0) + list(APPEND CMAKE_CXX_COMPILE_FEATURES + cxx_std_98 + cxx_std_11 + cxx_std_14 + ) + _record_compiler_features(CXX "" CMAKE_CXX_COMPILE_FEATURES) + endif() endmacro() diff --git a/Modules/Compiler/SunPro-CXX.cmake b/Modules/Compiler/SunPro-CXX.cmake index ce01cdd..e83c896 100644 --- a/Modules/Compiler/SunPro-CXX.cmake +++ b/Modules/Compiler/SunPro-CXX.cmake @@ -32,6 +32,8 @@ set(CMAKE_CXX_CREATE_STATIC_LIBRARY "<CMAKE_RANLIB> <TARGET> ") if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.13) + set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "") + set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "") set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++11") set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=c++11") endif() @@ -49,15 +51,11 @@ if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.13) endif() macro(cmake_record_cxx_compile_features) - macro(_get_solaris_studio_features std_version list) - record_compiler_features(CXX "${std_version}" ${list}) - endmacro() - set(_result 0) if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.13) - _get_solaris_studio_features(${CMAKE_CXX11_STANDARD_COMPILE_OPTION} CMAKE_CXX11_COMPILE_FEATURES) + _record_compiler_features_cxx(11) if (_result EQUAL 0) - _get_solaris_studio_features("" CMAKE_CXX98_COMPILE_FEATURES) + _record_compiler_features_cxx(98) endif() endif() endmacro() |