diff options
author | Brad King <brad.king@kitware.com> | 2015-01-19 18:55:31 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2015-01-19 18:55:31 (GMT) |
commit | 813ace90e4d02a782176ea13bcec15a3e9338210 (patch) | |
tree | 54198b83854486eeec7fee7fcf543e7641874adf /Tests | |
parent | 137a15bf1da72c795d8eeded4ad3848a5692dce6 (diff) | |
parent | 004e1540e0870e9b3bde19ad16c4f50b7d22df73 (diff) | |
download | CMake-813ace90e4d02a782176ea13bcec15a3e9338210.zip CMake-813ace90e4d02a782176ea13bcec15a3e9338210.tar.gz CMake-813ace90e4d02a782176ea13bcec15a3e9338210.tar.bz2 |
Merge topic 'GNU-4.4-compile-features'
004e1540 Features: Record for GNU 4.4.
2a5ca650 Features: Wrap failure-test in UNIX condition.
1ae2c6b2 Features: Blacklist cxx_constexpr test for GNU 4.5.
c66e3317 Features: Use a more-common feature in cycle-test.
c43a6dc5 Features: Update comment in test to match the code.
78259135 Features: Test presence of cxx_auto_type with genex.
7b9fc88b Features: Remove outdated comment.
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/CompileFeatures/CMakeLists.txt | 14 | ||||
-rw-r--r-- | Tests/CompileFeatures/genex_test.cpp | 13 | ||||
-rw-r--r-- | Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt | 14 | ||||
-rw-r--r-- | Tests/RunCMake/CompileFeatures/LinkImplementationFeatureCycle.cmake | 6 |
4 files changed, 25 insertions, 22 deletions
diff --git a/Tests/CompileFeatures/CMakeLists.txt b/Tests/CompileFeatures/CMakeLists.txt index 182954e..5cd0836 100644 --- a/Tests/CompileFeatures/CMakeLists.txt +++ b/Tests/CompileFeatures/CMakeLists.txt @@ -63,6 +63,14 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL SunPro) endif() if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" + AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.6) + # The cxx_constexpr feature happens to work (for *this* testcase) with + # GNU 4.5, but it is first documented as available with GNU 4.6. + list(REMOVE_ITEM CXX_non_features + cxx_constexpr + ) +endif() +if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8) # The cxx_alignof feature happens to work (for *this* testcase) with # GNU 4.7, but it is first documented as available with GNU 4.8. @@ -212,7 +220,7 @@ if (CMAKE_CXX_COMPILE_FEATURES) set_property(TARGET CompileFeaturesGenex PROPERTY CXX_STANDARD 11) target_compile_definitions(CompileFeaturesGenex PRIVATE HAVE_OVERRIDE_CONTROL=$<COMPILE_FEATURES:cxx_final,cxx_override> - HAVE_NULLPTR=$<COMPILE_FEATURES:cxx_nullptr> + HAVE_AUTO_TYPE=$<COMPILE_FEATURES:cxx_auto_type> HAVE_INHERITING_CONSTRUCTORS=$<COMPILE_FEATURES:cxx_inheriting_constructors> HAVE_FINAL=$<COMPILE_FEATURES:cxx_final> HAVE_INHERITING_CONSTRUCTORS_AND_FINAL=$<COMPILE_FEATURES:cxx_inheriting_constructors,cxx_final> @@ -222,7 +230,7 @@ if (CMAKE_CXX_COMPILE_FEATURES) target_compile_features(CompileFeaturesGenex2 PRIVATE cxx_static_assert) target_compile_definitions(CompileFeaturesGenex2 PRIVATE HAVE_OVERRIDE_CONTROL=$<COMPILE_FEATURES:cxx_final,cxx_override> - HAVE_NULLPTR=$<COMPILE_FEATURES:cxx_nullptr> + HAVE_AUTO_TYPE=$<COMPILE_FEATURES:cxx_auto_type> HAVE_INHERITING_CONSTRUCTORS=$<COMPILE_FEATURES:cxx_inheriting_constructors> HAVE_FINAL=$<COMPILE_FEATURES:cxx_final> HAVE_INHERITING_CONSTRUCTORS_AND_FINAL=$<COMPILE_FEATURES:cxx_inheriting_constructors,cxx_final> @@ -234,7 +242,7 @@ if (CMAKE_CXX_COMPILE_FEATURES) target_link_libraries(CompileFeaturesGenex3 PRIVATE static_assert_iface) target_compile_definitions(CompileFeaturesGenex3 PRIVATE HAVE_OVERRIDE_CONTROL=$<COMPILE_FEATURES:cxx_final,cxx_override> - HAVE_NULLPTR=$<COMPILE_FEATURES:cxx_nullptr> + HAVE_AUTO_TYPE=$<COMPILE_FEATURES:cxx_auto_type> HAVE_INHERITING_CONSTRUCTORS=$<COMPILE_FEATURES:cxx_inheriting_constructors> HAVE_FINAL=$<COMPILE_FEATURES:cxx_final> HAVE_INHERITING_CONSTRUCTORS_AND_FINAL=$<COMPILE_FEATURES:cxx_inheriting_constructors,cxx_final> diff --git a/Tests/CompileFeatures/genex_test.cpp b/Tests/CompileFeatures/genex_test.cpp index 0389dbd..d9c8eec 100644 --- a/Tests/CompileFeatures/genex_test.cpp +++ b/Tests/CompileFeatures/genex_test.cpp @@ -17,9 +17,9 @@ struct B final : A #endif -#if !HAVE_NULLPTR -#error "Expect nullptr feature" -#else +#if !HAVE_AUTO_TYPE +# error Expect cxx_auto_type support +#endif #if !HAVE_INHERITING_CONSTRUCTORS # if EXPECT_INHERITING_CONSTRUCTORS @@ -51,13 +51,6 @@ struct B final : A # endif #endif -const char* getString() -{ - return nullptr; -} - -#endif - int main() { diff --git a/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt b/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt index b725919..b5e46c0 100644 --- a/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt +++ b/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt @@ -25,12 +25,14 @@ if (NOT CMAKE_CXX_COMPILE_FEATURES AND NOT CMAKE_C_COMPILE_FEATURES) ) add_executable(WriteCompilerDetectionHeader "${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp") - include(CheckCXXSourceCompiles) - check_cxx_source_compiles("#include \"${CMAKE_CURRENT_BINARY_DIR}/test_compiler_detection.h\"\nint main() { return 0; }\n" - file_include_works - ) - if (file_include_works) - message(SEND_ERROR "Inclusion of ${CMAKE_CURRENT_BINARY_DIR}/test_compiler_detection.h was expected to cause an error, but did not.") + if(UNIX OR NOT CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + include(CheckCXXSourceCompiles) + check_cxx_source_compiles("#include \"${CMAKE_CURRENT_BINARY_DIR}/test_compiler_detection.h\"\nint main() { return 0; }\n" + file_include_works + ) + if (file_include_works) + message(SEND_ERROR "Inclusion of ${CMAKE_CURRENT_BINARY_DIR}/test_compiler_detection.h was expected to cause an error, but did not.") + endif() endif() return() endif() diff --git a/Tests/RunCMake/CompileFeatures/LinkImplementationFeatureCycle.cmake b/Tests/RunCMake/CompileFeatures/LinkImplementationFeatureCycle.cmake index d2c95ec..09594bd 100644 --- a/Tests/RunCMake/CompileFeatures/LinkImplementationFeatureCycle.cmake +++ b/Tests/RunCMake/CompileFeatures/LinkImplementationFeatureCycle.cmake @@ -6,10 +6,10 @@ add_library(empty3 INTERFACE) target_compile_features(empty3 INTERFACE cxx_static_assert) target_link_libraries(empty1 - # When starting, $<COMPILE_FEATURES:cxx_nullptr> is '0', so 'freeze' the + # When starting, $<COMPILE_FEATURES:cxx_auto_type> is '0', so 'freeze' the # CXX_STANDARD at 98 during computation. - $<$<COMPILE_FEATURES:cxx_nullptr>:empty2> - # This would add cxx_constexpr, but that would require CXX_STANDARD = 11, + $<$<COMPILE_FEATURES:cxx_auto_type>:empty2> + # This would add cxx_static_assert, but that would require CXX_STANDARD = 11, # which is not allowed after freeze. Report an error. empty3 ) |