diff options
-rw-r--r-- | .gitlab/ci/cxx_modules_rules_msvc.cmake | 10 | ||||
-rw-r--r-- | Help/dev/experimental.rst | 4 | ||||
-rw-r--r-- | Modules/Compiler/MSVC-CXX.cmake | 12 | ||||
-rw-r--r-- | Source/cmScanDepFormat.cxx | 22 | ||||
-rw-r--r-- | Tests/RunCMake/CXXModules/NoCXX20ModuleFlag-stderr.txt | 2 | ||||
-rw-r--r-- | Tests/RunCMake/CXXModules/NoCXX20ModuleFlag.cmake | 2 |
6 files changed, 19 insertions, 33 deletions
diff --git a/.gitlab/ci/cxx_modules_rules_msvc.cmake b/.gitlab/ci/cxx_modules_rules_msvc.cmake index 5f0ae76..2b09b0e 100644 --- a/.gitlab/ci/cxx_modules_rules_msvc.cmake +++ b/.gitlab/ci/cxx_modules_rules_msvc.cmake @@ -1,11 +1 @@ set(CMake_TEST_CXXModules_UUID "a246741c-d067-4019-a8fb-3d16b0c9d1d3") - -set(CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP 1) -string(CONCAT CMAKE_EXPERIMENTAL_CXX_SCANDEP_SOURCE - "<CMAKE_CXX_COMPILER> <DEFINES> <INCLUDES> <FLAGS> <SOURCE> -nologo -TP" - " -showIncludes" - " -scanDependencies <DYNDEP_FILE>" - " -Fo<OBJECT>") -set(CMAKE_EXPERIMENTAL_CXX_SCANDEP_DEPFILE_FORMAT "msvc") -set(CMAKE_EXPERIMENTAL_CXX_MODULE_MAP_FORMAT "msvc") -set(CMAKE_EXPERIMENTAL_CXX_MODULE_MAP_FLAG "@<MODULE_MAP_FILE>") diff --git a/Help/dev/experimental.rst b/Help/dev/experimental.rst index adfa36f..336137f 100644 --- a/Help/dev/experimental.rst +++ b/Help/dev/experimental.rst @@ -39,6 +39,10 @@ they can use it to develop and test their dependency scanning tool. The ``CMAKE_EXPERIMENTAL_CXX_SCANDEP_SOURCE`` variable must also be set to tell CMake how to invoke the C++20 module dependency scanning tool. +MSVC 19.34 (provided with Visual Studio 17.4) and above contains the support +that CMake needs and has these variables already set up as required and only +the UUID variable needs to be set. + For example, add code like the following to a test project: .. code-block:: cmake diff --git a/Modules/Compiler/MSVC-CXX.cmake b/Modules/Compiler/MSVC-CXX.cmake index 60d13f1..212f6d1 100644 --- a/Modules/Compiler/MSVC-CXX.cmake +++ b/Modules/Compiler/MSVC-CXX.cmake @@ -77,3 +77,15 @@ elseif (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 16.0) _record_compiler_features(CXX "" CMAKE_CXX_COMPILE_FEATURES) endmacro() endif() + +if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "19.34") + set(CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP 1) + string(CONCAT CMAKE_EXPERIMENTAL_CXX_SCANDEP_SOURCE + "<CMAKE_CXX_COMPILER> <DEFINES> <INCLUDES> <FLAGS> <SOURCE> -nologo -TP" + " -showIncludes" + " -scanDependencies <DYNDEP_FILE>" + " -Fo<OBJECT>") + set(CMAKE_EXPERIMENTAL_CXX_SCANDEP_DEPFILE_FORMAT "msvc") + set(CMAKE_EXPERIMENTAL_CXX_MODULE_MAP_FORMAT "msvc") + set(CMAKE_EXPERIMENTAL_CXX_MODULE_MAP_FLAG "@<MODULE_MAP_FILE>") +endif () diff --git a/Source/cmScanDepFormat.cxx b/Source/cmScanDepFormat.cxx index ec53af5..81ef3da 100644 --- a/Source/cmScanDepFormat.cxx +++ b/Source/cmScanDepFormat.cxx @@ -5,7 +5,6 @@ #include <cctype> #include <cstdio> -#include <iostream> #include <utility> #include <cm/optional> @@ -281,27 +280,6 @@ bool cmScanDepFormat_P1689_Parse(std::string const& arg_pp, info->Requires.push_back(require_info); } } - - // MSVC 17.3 toolchain bug. Remove when 17.4 is available. - if (rule.isMember("is-interface")) { - std::cerr - << "warning: acknowledging an VS 17.3 toolchain bug; accepting " - "until a new release which fixes it is available" - << std::endl; - - Json::Value const& is_interface_json = rule["is-interface"]; - if (!is_interface_json.isBool()) { - cmSystemTools::Error( - cmStrCat("-E cmake_ninja_dyndep failed to parse ", arg_pp, - ": is-interface is not a boolean")); - return false; - } - bool is_interface = is_interface_json.asBool(); - - for (auto& provide : info->Provides) { - provide.IsInterface = is_interface; - } - } } } diff --git a/Tests/RunCMake/CXXModules/NoCXX20ModuleFlag-stderr.txt b/Tests/RunCMake/CXXModules/NoCXX20ModuleFlag-stderr.txt index 5f90ec8..aa99af0 100644 --- a/Tests/RunCMake/CXXModules/NoCXX20ModuleFlag-stderr.txt +++ b/Tests/RunCMake/CXXModules/NoCXX20ModuleFlag-stderr.txt @@ -1,4 +1,4 @@ -CMake Warning \(dev\) at NoCXX20ModuleFlag.cmake:4 \(target_sources\): +CMake Warning \(dev\) at NoCXX20ModuleFlag.cmake:6 \(target_sources\): CMake's C\+\+ module support is experimental. It is meant only for experimentation and feedback to CMake developers. Call Stack \(most recent call first\): diff --git a/Tests/RunCMake/CXXModules/NoCXX20ModuleFlag.cmake b/Tests/RunCMake/CXXModules/NoCXX20ModuleFlag.cmake index 5f896f9..79892ee 100644 --- a/Tests/RunCMake/CXXModules/NoCXX20ModuleFlag.cmake +++ b/Tests/RunCMake/CXXModules/NoCXX20ModuleFlag.cmake @@ -1,5 +1,7 @@ enable_language(CXX) +unset(CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP) + add_library(noexperimentalflag) target_sources(noexperimentalflag PUBLIC |