diff options
author | Chuck Atkins <chuck.atkins@kitware.com> | 2017-05-15 18:06:29 (GMT) |
---|---|---|
committer | Chuck Atkins <chuck.atkins@kitware.com> | 2017-05-29 17:51:45 (GMT) |
commit | e556f1b909a910f7124bd26f82e4b42dd2142c17 (patch) | |
tree | 6077a5aa10d408d2b00e20b2993e5bb87cfc20c6 /Tests/Module | |
parent | 20ffa14708e5e1b324ac954fd06a1415b9398b7c (diff) | |
download | CMake-e556f1b909a910f7124bd26f82e4b42dd2142c17.zip CMake-e556f1b909a910f7124bd26f82e4b42dd2142c17.tar.gz CMake-e556f1b909a910f7124bd26f82e4b42dd2142c17.tar.bz2 |
CompileFeatures: Makes tests work with meta-feature only
Diffstat (limited to 'Tests/Module')
-rw-r--r-- | Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt b/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt index 2657aeb..52d4613 100644 --- a/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt +++ b/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt @@ -48,7 +48,14 @@ macro(set_defines target true_defs false_defs) ) endmacro() +# Only run the compiler detection header test for compilers with +# detailed features tables, not just meta-features + if (CMAKE_C_COMPILE_FEATURES) + set(C_expected_features ${CMAKE_C_COMPILE_FEATURES}) + list(FILTER C_expected_features EXCLUDE REGEX "^c_std_[0-9][0-9]") +endif() +if (C_expected_features) string(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" COMPILER_VERSION_MAJOR "${CMAKE_C_COMPILER_VERSION}") string(REGEX REPLACE "^[0-9]+\\.([0-9]+)\\.[0-9]+.*" "\\1" COMPILER_VERSION_MINOR "${CMAKE_C_COMPILER_VERSION}") string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" COMPILER_VERSION_PATCH "${CMAKE_C_COMPILER_VERSION}") @@ -85,7 +92,11 @@ if (CMAKE_C_COMPILE_FEATURES) endif() endif() -if (NOT CMAKE_CXX_COMPILE_FEATURES) +if (CMAKE_CXX_COMPILE_FEATURES) + set(CXX_expected_features ${CMAKE_CXX_COMPILE_FEATURES}) + list(FILTER CXX_expected_features EXCLUDE REGEX "^cxx_std_[0-9][0-9]") +endif() +if (NOT CXX_expected_features) file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp" "int main(int,char**) { return 0; }\n" ) |