Tests/RunCMake/CXXModules: add support for Visual Studio

This commit is contained in:
Ben Boeckel
2022-11-28 11:36:14 -05:00
parent 069a32b03c
commit 388acfd46d
2 changed files with 8 additions and 0 deletions

View File

@@ -43,6 +43,11 @@ if (RunCMake_GENERATOR MATCHES "Ninja" AND
set(generator_supports_cxx_modules 1)
endif ()
if (RunCMake_GENERATOR MATCHES "Visual Studio" AND
CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "19.34")
set(generator_supports_cxx_modules 1)
endif ()
# Test behavior when the generator does not support C++20 modules.
if (NOT generator_supports_cxx_modules)
if ("cxx_std_20" IN_LIST CMAKE_CXX_COMPILE_FEATURES)
@@ -84,6 +89,8 @@ if (RunCMake_GENERATOR MATCHES "Ninja")
run_cmake(NinjaDependInfoFileSet)
run_cmake(NinjaDependInfoExport)
run_cmake(NinjaDependInfoBMIInstall)
elseif (RunCMake_GENERATOR MATCHES "Visual Studio")
# Not supported yet.
else ()
message(FATAL_ERROR
"Please add 'DependInfo' tests for the '${RunCMake_GENERATOR}' generator.")

View File

@@ -20,6 +20,7 @@ string(APPEND info "\
set(CMAKE_CXX_COMPILE_FEATURES \"${CMAKE_CXX_COMPILE_FEATURES}\")
set(CMAKE_MAKE_PROGRAM \"${CMAKE_MAKE_PROGRAM}\")
set(forced_cxx_standard \"${forced_cxx_standard}\")
set(CMAKE_CXX_COMPILER_VERSION \"${CMAKE_CXX_COMPILER_VERSION}\")
")
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/info.cmake" "${info}")