diff options
author | Stephen Kelly <steveire@gmail.com> | 2015-01-11 15:22:24 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2015-01-15 21:13:22 (GMT) |
commit | 938bd94eb0b34e1b5be12dcceaab641efc8a7e43 (patch) | |
tree | dfff660d9775437607914b778435c510f284a312 /Modules/Compiler | |
parent | 462c630b8a6d832dd37562fcd7b00a75e1ec6e82 (diff) | |
download | CMake-938bd94eb0b34e1b5be12dcceaab641efc8a7e43.zip CMake-938bd94eb0b34e1b5be12dcceaab641efc8a7e43.tar.gz CMake-938bd94eb0b34e1b5be12dcceaab641efc8a7e43.tar.bz2 |
Features: Test __GXX_EXPERIMENTAL_CXX0X__ macro for GNU < 4.7 compatibility.
Diffstat (limited to 'Modules/Compiler')
-rw-r--r-- | Modules/Compiler/GNU-CXX-FeatureTests.cmake | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/Modules/Compiler/GNU-CXX-FeatureTests.cmake b/Modules/Compiler/GNU-CXX-FeatureTests.cmake index 8f812da..3c6c663 100644 --- a/Modules/Compiler/GNU-CXX-FeatureTests.cmake +++ b/Modules/Compiler/GNU-CXX-FeatureTests.cmake @@ -54,8 +54,13 @@ set(_cmake_feature_test_cxx_user_literals "${GNU47_CXX11}") # support -std=c++11. Prior to that, support for C++11 features is technically # experiemental and possibly incomplete (see for example the note below about # cxx_variadic_template_template_parameters) +# GNU does not define __cplusplus correctly before version 4.7. +# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=1773 +# __GXX_EXPERIMENTAL_CXX0X__ is defined in prior versions, but may not be +# defined in the future. +set(GNU_CXX0X_DEFINED "(__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__))") # TODO: Should be supported by GNU 4.6 -set(GNU46_CXX11 "${_cmake_oldestSupported} && __cplusplus >= 201103L") +set(GNU46_CXX11 "${_cmake_oldestSupported} && ${GNU_CXX0X_DEFINED}") set(_cmake_feature_test_cxx_constexpr "${GNU46_CXX11}") set(_cmake_feature_test_cxx_defaulted_move_initializers "${GNU46_CXX11}") set(_cmake_feature_test_cxx_enum_forward_declarations "${GNU46_CXX11}") @@ -64,13 +69,13 @@ set(_cmake_feature_test_cxx_nullptr "${GNU46_CXX11}") set(_cmake_feature_test_cxx_range_for "${GNU46_CXX11}") set(_cmake_feature_test_cxx_unrestricted_unions "${GNU46_CXX11}") # TODO: Should be supported by GNU 4.5 -set(GNU45_CXX11 "${_cmake_oldestSupported} && __cplusplus >= 201103L") +set(GNU45_CXX11 "${_cmake_oldestSupported} && ${GNU_CXX0X_DEFINED}") set(_cmake_feature_test_cxx_explicit_conversions "${GNU45_CXX11}") set(_cmake_feature_test_cxx_lambdas "${GNU45_CXX11}") set(_cmake_feature_test_cxx_local_type_template_args "${GNU45_CXX11}") set(_cmake_feature_test_cxx_raw_string_literals "${GNU45_CXX11}") # TODO: Should be supported by GNU 4.4 -set(GNU44_CXX11 "${_cmake_oldestSupported} && __cplusplus >= 201103L") +set(GNU44_CXX11 "${_cmake_oldestSupported} && ${GNU_CXX0X_DEFINED}") set(_cmake_feature_test_cxx_auto_type "${GNU44_CXX11}") set(_cmake_feature_test_cxx_defaulted_functions "${GNU44_CXX11}") set(_cmake_feature_test_cxx_deleted_functions "${GNU44_CXX11}") @@ -90,7 +95,7 @@ set(_cmake_feature_test_cxx_variadic_templates "${GNU44_CXX11}") # templates capability in CMake. See # http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2555.pdf # TODO: Should be supported by GNU 4.3 -set(GNU43_CXX11 "${_cmake_oldestSupported} && __cplusplus >= 201103L") +set(GNU43_CXX11 "${_cmake_oldestSupported} && ${GNU_CXX0X_DEFINED}") set(_cmake_feature_test_cxx_decltype "${GNU43_CXX11}") set(_cmake_feature_test_cxx_default_function_template_args "${GNU43_CXX11}") set(_cmake_feature_test_cxx_long_long_type "${GNU43_CXX11}") @@ -98,8 +103,8 @@ set(_cmake_feature_test_cxx_right_angle_brackets "${GNU43_CXX11}") set(_cmake_feature_test_cxx_rvalue_references "${GNU43_CXX11}") set(_cmake_feature_test_cxx_static_assert "${GNU43_CXX11}") # TODO: Should be supported since GNU 3.4? -set(_cmake_feature_test_cxx_extern_templates "${_cmake_oldestSupported} && __cplusplus >= 201103L") +set(_cmake_feature_test_cxx_extern_templates "${_cmake_oldestSupported} && ${GNU_CXX0X_DEFINED}") # TODO: Should be supported forever? -set(_cmake_feature_test_cxx_func_identifier "${_cmake_oldestSupported} && __cplusplus >= 201103L") -set(_cmake_feature_test_cxx_variadic_macros "${_cmake_oldestSupported} && __cplusplus >= 201103L") +set(_cmake_feature_test_cxx_func_identifier "${_cmake_oldestSupported} && ${GNU_CXX0X_DEFINED}") +set(_cmake_feature_test_cxx_variadic_macros "${_cmake_oldestSupported} && ${GNU_CXX0X_DEFINED}") set(_cmake_feature_test_cxx_template_template_parameters "${_cmake_oldestSupported} && __cplusplus") |