diff options
author | Ben Boeckel <ben.boeckel@kitware.com> | 2022-11-28 16:34:31 (GMT) |
---|---|---|
committer | Ben Boeckel <ben.boeckel@kitware.com> | 2022-12-01 16:42:46 (GMT) |
commit | ef03a3a2f534d694d0a58ce610db152d28abb1d7 (patch) | |
tree | 1560cb5d95f92ab73e4158b701cd4fbf65f54113 /Tests | |
parent | 736123464f421e7149061663d1cd6da8d975654e (diff) | |
download | CMake-ef03a3a2f534d694d0a58ce610db152d28abb1d7.zip CMake-ef03a3a2f534d694d0a58ce610db152d28abb1d7.tar.gz CMake-ef03a3a2f534d694d0a58ce610db152d28abb1d7.tar.bz2 |
Tests/RunCMake/CXXModules: factor out generator support detection
This keeps the condition to a readable limit.
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/RunCMake/CXXModules/RunCMakeTest.cmake | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/Tests/RunCMake/CXXModules/RunCMakeTest.cmake b/Tests/RunCMake/CXXModules/RunCMakeTest.cmake index 81a086a..73853a0 100644 --- a/Tests/RunCMake/CXXModules/RunCMakeTest.cmake +++ b/Tests/RunCMake/CXXModules/RunCMakeTest.cmake @@ -36,10 +36,15 @@ if (RunCMake_GENERATOR MATCHES "Ninja") endif () endif () +set(generator_supports_cxx_modules 0) +if (RunCMake_GENERATOR MATCHES "Ninja" AND + ninja_version VERSION_GREATER_EQUAL "1.10" AND + "cxx_std_20" IN_LIST CMAKE_CXX_COMPILE_FEATURES) + set(generator_supports_cxx_modules 1) +endif () + # Test behavior when the generator does not support C++20 modules. -if (NOT RunCMake_GENERATOR MATCHES "Ninja" OR - ninja_version VERSION_LESS "1.10" OR - NOT "cxx_std_20" IN_LIST CMAKE_CXX_COMPILE_FEATURES) +if (NOT generator_supports_cxx_modules) if ("cxx_std_20" IN_LIST CMAKE_CXX_COMPILE_FEATURES) run_cmake(NoDyndepSupport) endif () |