Tests/RunCMake/CXXModules: factor out generator support detection

This keeps the condition to a readable limit.
This commit is contained in:
Ben Boeckel
2022-11-28 11:34:31 -05:00
parent 736123464f
commit ef03a3a2f5

View File

@@ -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 ()