diff options
author | Brad King <brad.king@kitware.com> | 2014-05-08 15:28:03 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2014-05-08 15:28:03 (GMT) |
commit | f1d504d6cd1812812520326171c4819febb76325 (patch) | |
tree | 03a37ef4e49bbc5b024df2aa111ae88808bf5e53 /Tests | |
parent | a07b979c1c1b6e89209889f4b1fe70d0e9ca6d45 (diff) | |
parent | 9cbc63e40caa1c3afd771d1e20c4c4c188953c00 (diff) | |
download | CMake-f1d504d6cd1812812520326171c4819febb76325.zip CMake-f1d504d6cd1812812520326171c4819febb76325.tar.gz CMake-f1d504d6cd1812812520326171c4819febb76325.tar.bz2 |
Merge topic 'GNU-4.7-features'
9cbc63e4 Features: Record for GNU 4.7.
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/CompileFeatures/CMakeLists.txt | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/Tests/CompileFeatures/CMakeLists.txt b/Tests/CompileFeatures/CMakeLists.txt index a991e77..274c5ba 100644 --- a/Tests/CompileFeatures/CMakeLists.txt +++ b/Tests/CompileFeatures/CMakeLists.txt @@ -11,22 +11,33 @@ if (NOT CMAKE_CXX_COMPILE_FEATURES) return() endif() -macro(run_test feature) - if (";${CMAKE_CXX_COMPILE_FEATURES};" MATCHES ${feature}) - add_library(test_${feature} OBJECT ${feature}.cpp) +macro(run_test feature lang) + if (";${CMAKE_${lang}_COMPILE_FEATURES};" MATCHES ${feature}) + add_library(test_${feature} OBJECT ${feature}) set_property(TARGET test_${feature} PROPERTY COMPILE_FEATURES "${feature}" ) else() - message("Not supported: ${feature}") + list(APPEND ${lang}_non_features ${feature}) endif() endmacro() -get_property(features GLOBAL PROPERTY CMAKE_CXX_KNOWN_FEATURES) -foreach(feature ${features}) - run_test(${feature}) +get_property(cxx_features GLOBAL PROPERTY CMAKE_CXX_KNOWN_FEATURES) +foreach(feature ${cxx_features}) + run_test(${feature} CXX) endforeach() +if (CMAKE_CXX_COMPILE_FEATURES) + include(CheckCXXSourceCompiles) + foreach(feature ${CXX_non_features}) + check_cxx_source_compiles("#include \"${CMAKE_CURRENT_SOURCE_DIR}/${feature}.cpp\"\nint main() { return 0; }\n" ${feature}_works) + if (${feature}_works) + message(SEND_ERROR + "Feature ${feature} expected not to work for ${CMAKE_CXX_COMPILER_ID}-${CMAKE_CXX_COMPILER_VERSION}. Update the supported features or blacklist it.") + endif() + endforeach() +endif() + add_executable(CompileFeatures main.cpp) set_property(TARGET CompileFeatures PROPERTY COMPILE_FEATURES "cxx_auto_type" |