summaryrefslogtreecommitdiff
path: root/Tests
diff options
context:
space:
mode:
authorBen Boeckel <ben.boeckel@kitware.com>2022-11-28 11:34:31 -0500
committerBen Boeckel <ben.boeckel@kitware.com>2022-12-01 11:42:46 -0500
commitef03a3a2f534d694d0a58ce610db152d28abb1d7 (patch)
tree1560cb5d95f92ab73e4158b701cd4fbf65f54113 /Tests
parent736123464f421e7149061663d1cd6da8d975654e (diff)
downloadcmake-ef03a3a2f534d694d0a58ce610db152d28abb1d7.tar.gz
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.cmake11
1 files changed, 8 insertions, 3 deletions
diff --git a/Tests/RunCMake/CXXModules/RunCMakeTest.cmake b/Tests/RunCMake/CXXModules/RunCMakeTest.cmake
index 81a086af5a..73853a09a5 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 ()