diff options
author | Brad King <brad.king@kitware.com> | 2015-01-26 21:42:36 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2015-01-29 20:01:40 (GMT) |
commit | 3228fc5049e72e6d7584a6f3cec6055b8a726817 (patch) | |
tree | 5525012740e92d95e5721c6b549ef80c091dd6bb /Tests/RunCMake/CompileFeatures | |
parent | ea7ca139ea4c3c88e432e722c9cfe1dd86a4359f (diff) | |
download | CMake-3228fc5049e72e6d7584a6f3cec6055b8a726817.zip CMake-3228fc5049e72e6d7584a6f3cec6055b8a726817.tar.gz CMake-3228fc5049e72e6d7584a6f3cec6055b8a726817.tar.bz2 |
Features: Define meaning for no language standard default
Define an empty string in CMAKE_<LANG>_STANDARD_DEFAULT to mean that
the toolchain has no notion of lanuage standard levels. In this case
the <LANG>_STANDARD[_REQUIRED] properties will have no effect.
Update the RunCMake.CompileFeatures test to exclude the
LinkImplementationFeatureCycle test when there is no standard default.
It can never fail because no use of specific features will adjust the
CXX_STANDARD level required for any target since the standard levels
have no meaning in this case.
Diffstat (limited to 'Tests/RunCMake/CompileFeatures')
-rw-r--r-- | Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake | 36 | ||||
-rw-r--r-- | Tests/RunCMake/CompileFeatures/generate_feature_list.cmake | 14 |
2 files changed, 35 insertions, 15 deletions
diff --git a/Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake b/Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake index 376f75a..833a315 100644 --- a/Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake +++ b/Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake @@ -17,6 +17,8 @@ file(READ "${RunCMake_BINARY_DIR}/generate_feature_list-build/cxx_features.txt" CXX_FEATURES ) +include("${RunCMake_BINARY_DIR}/generate_feature_list-build/c_standard_default.cmake") +include("${RunCMake_BINARY_DIR}/generate_feature_list-build/cxx_standard_default.cmake") if (NOT C_FEATURES) run_cmake(NoSupportedCFeatures) @@ -27,7 +29,9 @@ if (NOT CXX_FEATURES) run_cmake(NoSupportedCxxFeatures) run_cmake(NoSupportedCxxFeaturesGenex) else() - run_cmake(LinkImplementationFeatureCycle) + if(CXX_STANDARD_DEFAULT) + run_cmake(LinkImplementationFeatureCycle) + endif() run_cmake(LinkImplementationFeatureCycleSolved) if (";${CXX_FEATURES};" MATCHES ";cxx_final;") @@ -38,17 +42,19 @@ else() unset(RunCMake_TEST_OPTIONS) endif() -foreach(standard 98 11) - file(READ - "${RunCMake_BINARY_DIR}/generate_feature_list-build/cxx${standard}_flag.txt" - CXX${standard}_FLAG - ) - if (CXX${standard}_FLAG STREQUAL NOTFOUND) - run_cmake(RequireCXX${standard}) - run_cmake(RequireCXX${standard}Variable) - endif() - if (CXX${standard}EXT_FLAG STREQUAL NOTFOUND) - run_cmake(RequireCXX${standard}Ext) - run_cmake(RequireCXX${standard}ExtVariable) - endif() -endforeach() +if(CXX_STANDARD_DEFAULT) + foreach(standard 98 11) + file(READ + "${RunCMake_BINARY_DIR}/generate_feature_list-build/cxx${standard}_flag.txt" + CXX${standard}_FLAG + ) + if (CXX${standard}_FLAG STREQUAL NOTFOUND) + run_cmake(RequireCXX${standard}) + run_cmake(RequireCXX${standard}Variable) + endif() + if (CXX${standard}EXT_FLAG STREQUAL NOTFOUND) + run_cmake(RequireCXX${standard}Ext) + run_cmake(RequireCXX${standard}ExtVariable) + endif() + endforeach() +endif() diff --git a/Tests/RunCMake/CompileFeatures/generate_feature_list.cmake b/Tests/RunCMake/CompileFeatures/generate_feature_list.cmake index 09e17b1..5c58052 100644 --- a/Tests/RunCMake/CompileFeatures/generate_feature_list.cmake +++ b/Tests/RunCMake/CompileFeatures/generate_feature_list.cmake @@ -9,6 +9,20 @@ file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/cxx_features.txt" "${CMAKE_CXX_COMPILE_FEATURES}" ) +if(DEFINED CMAKE_C_STANDARD_DEFAULT) + set(c_standard_default_code "set(C_STANDARD_DEFAULT \"${CMAKE_C_STANDARD_DEFAULT}\")\n") +else() + set(c_standard_default_code "unset(C_STANDARD_DEFAULT)\n") +endif() +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/c_standard_default.cmake" "${c_standard_default_code}") + +if(DEFINED CMAKE_CXX_STANDARD_DEFAULT) + set(cxx_standard_default_code "set(CXX_STANDARD_DEFAULT \"${CMAKE_CXX_STANDARD_DEFAULT}\")\n") +else() + set(cxx_standard_default_code "unset(CXX_STANDARD_DEFAULT)\n") +endif() +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/cxx_standard_default.cmake" "${cxx_standard_default_code}") + foreach(standard 98 11) set(CXX${standard}_FLAG NOTFOUND) if (DEFINED CMAKE_CXX${standard}_STANDARD_COMPILE_OPTION) |