mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-05 21:31:08 -06:00
msvc: bless MSVC 19.34 support for C++ modules as experimental
Visual Studio 17.4 now contains official support for what CMake needs.
This commit is contained in:
@@ -1,11 +1 @@
|
|||||||
set(CMake_TEST_CXXModules_UUID "a246741c-d067-4019-a8fb-3d16b0c9d1d3")
|
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>")
|
|
||||||
|
|||||||
@@ -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
|
The ``CMAKE_EXPERIMENTAL_CXX_SCANDEP_SOURCE`` variable must also be set
|
||||||
to tell CMake how to invoke the C++20 module dependency scanning tool.
|
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:
|
For example, add code like the following to a test project:
|
||||||
|
|
||||||
.. code-block:: cmake
|
.. code-block:: cmake
|
||||||
|
|||||||
@@ -77,3 +77,15 @@ elseif (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 16.0)
|
|||||||
_record_compiler_features(CXX "" CMAKE_CXX_COMPILE_FEATURES)
|
_record_compiler_features(CXX "" CMAKE_CXX_COMPILE_FEATURES)
|
||||||
endmacro()
|
endmacro()
|
||||||
endif()
|
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 ()
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
#include <cctype>
|
#include <cctype>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <iostream>
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#include <cm/optional>
|
#include <cm/optional>
|
||||||
@@ -281,27 +280,6 @@ bool cmScanDepFormat_P1689_Parse(std::string const& arg_pp,
|
|||||||
info->Requires.push_back(require_info);
|
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,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
|
CMake's C\+\+ module support is experimental. It is meant only for
|
||||||
experimentation and feedback to CMake developers.
|
experimentation and feedback to CMake developers.
|
||||||
Call Stack \(most recent call first\):
|
Call Stack \(most recent call first\):
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
enable_language(CXX)
|
enable_language(CXX)
|
||||||
|
|
||||||
|
unset(CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP)
|
||||||
|
|
||||||
add_library(noexperimentalflag)
|
add_library(noexperimentalflag)
|
||||||
target_sources(noexperimentalflag
|
target_sources(noexperimentalflag
|
||||||
PUBLIC
|
PUBLIC
|
||||||
|
|||||||
Reference in New Issue
Block a user