Features: Record for GNU 4.6.

Adjust the CompileFeatures genex_test for the expectation of the
OVERRIDE_CONTROL feature group.
This commit is contained in:
Stephen Kelly 2015-01-10 20:05:54 +01:00
parent f13a2eb118
commit b15c008fac
5 changed files with 12 additions and 8 deletions

View File

@ -1,12 +1,12 @@
set(_cmake_oldestSupported "(__GNUC__ * 100 + __GNUC_MINOR__) >= 407") set(_cmake_oldestSupported "(__GNUC__ * 100 + __GNUC_MINOR__) >= 406")
# GNU 4.7 correctly sets __STDC_VERSION__ to 201112L, but GNU 4.6 sets it # GNU 4.7 correctly sets __STDC_VERSION__ to 201112L, but GNU 4.6 sets it
# to 201000L. As the former is strictly greater than the latter, test only # to 201000L. As the former is strictly greater than the latter, test only
# for the latter. If in the future CMake learns about a C feature which was # for the latter. If in the future CMake learns about a C feature which was
# introduced with GNU 4.7, that should test for the correct version, similar # introduced with GNU 4.7, that should test for the correct version, similar
# to the distinction between __cplusplus and __GXX_EXPERIMENTAL_CXX0X__ tests. # to the distinction between __cplusplus and __GXX_EXPERIMENTAL_CXX0X__ tests.
set(GNU46_C11 "${_cmake_oldestSupported} && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201000L") set(GNU46_C11 "(__GNUC__ * 100 + __GNUC_MINOR__) >= 406 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201000L")
set(_cmake_feature_test_c_static_assert "${GNU46_C11}") set(_cmake_feature_test_c_static_assert "${GNU46_C11}")
# Since 4.4 at least: # Since 4.4 at least:
set(GNU44_C99 "${_cmake_oldestSupported} && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L") set(GNU44_C99 "${_cmake_oldestSupported} && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L")

View File

@ -29,7 +29,7 @@ macro(cmake_record_c_compile_features)
endmacro() endmacro()
set(_result 0) set(_result 0)
if (UNIX AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.7) if (UNIX AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.6)
_get_gcc_features(${CMAKE_C11_STANDARD_COMPILE_OPTION} CMAKE_C11_COMPILE_FEATURES) _get_gcc_features(${CMAKE_C11_STANDARD_COMPILE_OPTION} CMAKE_C11_COMPILE_FEATURES)
if (_result EQUAL 0) if (_result EQUAL 0)
_get_gcc_features(${CMAKE_C99_STANDARD_COMPILE_OPTION} CMAKE_C99_COMPILE_FEATURES) _get_gcc_features(${CMAKE_C99_STANDARD_COMPILE_OPTION} CMAKE_C99_COMPILE_FEATURES)

View File

@ -2,7 +2,7 @@
# Reference: http://gcc.gnu.org/projects/cxx0x.html # Reference: http://gcc.gnu.org/projects/cxx0x.html
# http://gcc.gnu.org/projects/cxx1y.html # http://gcc.gnu.org/projects/cxx1y.html
set(_cmake_oldestSupported "(__GNUC__ * 100 + __GNUC_MINOR__) >= 407") set(_cmake_oldestSupported "(__GNUC__ * 100 + __GNUC_MINOR__) >= 406")
set(GNU50_CXX14 "(__GNUC__ * 100 + __GNUC_MINOR__) >= 500 && __cplusplus >= 201402L") set(GNU50_CXX14 "(__GNUC__ * 100 + __GNUC_MINOR__) >= 500 && __cplusplus >= 201402L")
set(_cmake_feature_test_cxx_variable_templates "${GNU50_CXX14}") set(_cmake_feature_test_cxx_variable_templates "${GNU50_CXX14}")
@ -60,7 +60,7 @@ set(_cmake_feature_test_cxx_user_literals "${GNU47_CXX11}")
# defined in the future. # defined in the future.
set(GNU_CXX0X_DEFINED "(__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__))") set(GNU_CXX0X_DEFINED "(__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__))")
# TODO: Should be supported by GNU 4.6 # TODO: Should be supported by GNU 4.6
set(GNU46_CXX11 "${_cmake_oldestSupported} && ${GNU_CXX0X_DEFINED}") set(GNU46_CXX11 "(__GNUC__ * 100 + __GNUC_MINOR__) >= 406 && ${GNU_CXX0X_DEFINED}")
set(_cmake_feature_test_cxx_constexpr "${GNU46_CXX11}") set(_cmake_feature_test_cxx_constexpr "${GNU46_CXX11}")
set(_cmake_feature_test_cxx_defaulted_move_initializers "${GNU46_CXX11}") set(_cmake_feature_test_cxx_defaulted_move_initializers "${GNU46_CXX11}")
set(_cmake_feature_test_cxx_enum_forward_declarations "${GNU46_CXX11}") set(_cmake_feature_test_cxx_enum_forward_declarations "${GNU46_CXX11}")

View File

@ -45,7 +45,7 @@ macro(cmake_record_cxx_compile_features)
if (UNIX AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8) if (UNIX AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8)
_get_gcc_features(${CMAKE_CXX14_STANDARD_COMPILE_OPTION} CMAKE_CXX14_COMPILE_FEATURES) _get_gcc_features(${CMAKE_CXX14_STANDARD_COMPILE_OPTION} CMAKE_CXX14_COMPILE_FEATURES)
endif() endif()
if (UNIX AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7) if (UNIX AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.6)
if (_result EQUAL 0) if (_result EQUAL 0)
_get_gcc_features(${CMAKE_CXX11_STANDARD_COMPILE_OPTION} CMAKE_CXX11_COMPILE_FEATURES) _get_gcc_features(${CMAKE_CXX11_STANDARD_COMPILE_OPTION} CMAKE_CXX11_COMPILE_FEATURES)
endif() endif()

View File

@ -142,23 +142,24 @@ if (CMAKE_CXX_COMPILE_FEATURES)
add_executable(IfaceCompileFeatures main.cpp) add_executable(IfaceCompileFeatures main.cpp)
target_link_libraries(IfaceCompileFeatures iface) target_link_libraries(IfaceCompileFeatures iface)
add_definitions(-DEXPECT_OVERRIDE_CONTROL=1)
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8) if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8)
add_definitions( add_definitions(
-DEXPECT_OVERRIDE_CONTROL=1
-DEXPECT_INHERITING_CONSTRUCTORS=1 -DEXPECT_INHERITING_CONSTRUCTORS=1
-DEXPECT_FINAL=1 -DEXPECT_FINAL=1
-DEXPECT_INHERITING_CONSTRUCTORS_AND_FINAL=1 -DEXPECT_INHERITING_CONSTRUCTORS_AND_FINAL=1
) )
elseif (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7) elseif (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7)
add_definitions( add_definitions(
-DEXPECT_OVERRIDE_CONTROL=1
-DEXPECT_INHERITING_CONSTRUCTORS=0 -DEXPECT_INHERITING_CONSTRUCTORS=0
-DEXPECT_FINAL=1 -DEXPECT_FINAL=1
-DEXPECT_INHERITING_CONSTRUCTORS_AND_FINAL=0 -DEXPECT_INHERITING_CONSTRUCTORS_AND_FINAL=0
) )
else() else()
add_definitions( add_definitions(
-DEXPECT_OVERRIDE_CONTROL=0
-DEXPECT_INHERITING_CONSTRUCTORS=0 -DEXPECT_INHERITING_CONSTRUCTORS=0
-DEXPECT_FINAL=0 -DEXPECT_FINAL=0
-DEXPECT_INHERITING_CONSTRUCTORS_AND_FINAL=0 -DEXPECT_INHERITING_CONSTRUCTORS_AND_FINAL=0
@ -166,6 +167,7 @@ if (CMAKE_CXX_COMPILE_FEATURES)
endif() endif()
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
add_definitions( add_definitions(
-DEXPECT_OVERRIDE_CONTROL=1
-DEXPECT_INHERITING_CONSTRUCTORS=1 -DEXPECT_INHERITING_CONSTRUCTORS=1
-DEXPECT_FINAL=1 -DEXPECT_FINAL=1
-DEXPECT_INHERITING_CONSTRUCTORS_AND_FINAL=1 -DEXPECT_INHERITING_CONSTRUCTORS_AND_FINAL=1
@ -173,12 +175,14 @@ if (CMAKE_CXX_COMPILE_FEATURES)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") elseif(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0) if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0)
add_definitions( add_definitions(
-DEXPECT_OVERRIDE_CONTROL=1
-DEXPECT_INHERITING_CONSTRUCTORS=1 -DEXPECT_INHERITING_CONSTRUCTORS=1
-DEXPECT_FINAL=1 -DEXPECT_FINAL=1
-DEXPECT_INHERITING_CONSTRUCTORS_AND_FINAL=1 -DEXPECT_INHERITING_CONSTRUCTORS_AND_FINAL=1
) )
else() else()
add_definitions( add_definitions(
-DEXPECT_OVERRIDE_CONTROL=1
-DEXPECT_INHERITING_CONSTRUCTORS=0 -DEXPECT_INHERITING_CONSTRUCTORS=0
-DEXPECT_FINAL=1 -DEXPECT_FINAL=1
-DEXPECT_INHERITING_CONSTRUCTORS_AND_FINAL=0 -DEXPECT_INHERITING_CONSTRUCTORS_AND_FINAL=0