소스 검색

msvc: bless MSVC 19.34 support for C++ modules as experimental

Visual Studio 17.4 now contains official support for what CMake needs.
Ben Boeckel 3 년 전
부모
커밋
0e9782b336

+ 0 - 10
.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>")

+ 4 - 0
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

+ 12 - 0
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 ()

+ 0 - 22
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;
-        }
-      }
     }
   }
 

+ 1 - 1
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\):

+ 2 - 0
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