summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-09-16 12:16:42 (GMT)
committerKitware Robot <kwrobot@kitware.com>2021-09-16 12:16:54 (GMT)
commit1b91aaecd8ab707e1f245bc911baebd55637881a (patch)
tree5278baf7e69de4e030c9acc95d81e7a05fb23f03
parent86d0d78f2e6d39d22878b2a15f66ec854ed06848 (diff)
parentb6ac10394b88b476f069ba75426c1556ab8bfe00 (diff)
downloadCMake-1b91aaecd8ab707e1f245bc911baebd55637881a.zip
CMake-1b91aaecd8ab707e1f245bc911baebd55637881a.tar.gz
CMake-1b91aaecd8ab707e1f245bc911baebd55637881a.tar.bz2
Merge topic 'vs2022'
b6ac10394b VS: Update Visual Studio 17 2022 generator for Preview 4 f200f4d5a7 VS: Fix managed C++ project generation for VS 2022 Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !6524
-rw-r--r--Help/generator/Visual Studio 17 2022.rst4
-rw-r--r--Help/release/3.21.rst8
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx4
-rw-r--r--Tests/VSWindowsFormsResx/CMakeLists.txt6
4 files changed, 19 insertions, 3 deletions
diff --git a/Help/generator/Visual Studio 17 2022.rst b/Help/generator/Visual Studio 17 2022.rst
index 8b97b9f..708909e 100644
--- a/Help/generator/Visual Studio 17 2022.rst
+++ b/Help/generator/Visual Studio 17 2022.rst
@@ -7,7 +7,7 @@ Generates Visual Studio 17 (VS 2022) project files.
.. warning::
- This is experimental and based on "Visual Studio 2022 Preview 3.1".
+ This is experimental and based on "Visual Studio 2022 Preview 4".
As of this version of CMake, VS 2022 has not been released.
Project Types
@@ -51,7 +51,7 @@ name (architecture). For example:
Toolset Selection
^^^^^^^^^^^^^^^^^
-The ``v143`` toolset that comes with VS 17 2022 Preview 3.1 is selected by
+The ``v143`` toolset that comes with VS 17 2022 Preview 4 is selected by
default. The :variable:`CMAKE_GENERATOR_TOOLSET` option may be set, perhaps
via the :manual:`cmake(1)` ``-T`` option, to specify another toolset.
diff --git a/Help/release/3.21.rst b/Help/release/3.21.rst
index a5125ac..5d8c200 100644
--- a/Help/release/3.21.rst
+++ b/Help/release/3.21.rst
@@ -27,7 +27,7 @@ Generators
----------
* The :generator:`Visual Studio 17 2022` generator was added. This is
- experimental and based on "Visual Studio 2022 Preview 3.1" because this
+ experimental and based on "Visual Studio 2022 Preview 4" because this
version of VS has not been released.
* The :ref:`Makefile Generators` and the :generator:`Ninja` generator
@@ -313,3 +313,9 @@ Changes made since CMake 3.21.0 include the following.
* The :generator:`Visual Studio 17 2022` generator is now based on
"Visual Studio 2022 Preview 3.1". Previously it was based on "Preview 2".
+
+3.21.3
+------
+
+* The :generator:`Visual Studio 17 2022` generator is now based on
+ "Visual Studio 2022 Preview 4". Previously it was based on "Preview 3.1".
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 75fb05f..e7ef7ea 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -578,6 +578,10 @@ void cmVisualStudio10TargetGenerator::Generate()
}
if (this->Managed) {
+ if (this->LocalGenerator->GetVersion() >=
+ cmGlobalVisualStudioGenerator::VS17) {
+ e1.Element("ManagedAssembly", "true");
+ }
std::string outputType;
switch (this->GeneratorTarget->GetType()) {
case cmStateEnums::OBJECT_LIBRARY:
diff --git a/Tests/VSWindowsFormsResx/CMakeLists.txt b/Tests/VSWindowsFormsResx/CMakeLists.txt
index 43c4833..b9b2163 100644
--- a/Tests/VSWindowsFormsResx/CMakeLists.txt
+++ b/Tests/VSWindowsFormsResx/CMakeLists.txt
@@ -33,6 +33,12 @@ set(TARGET_RESX
set(TARGET_LIBRARIES ${SYSLIBS})
add_executable(${PROJECT_NAME} ${TARGET_SRC} ${TARGET_H} ${TARGET_RESX})
+if(NOT CMAKE_GENERATOR MATCHES "Visual Studio 1[0-6]")
+ # VS 17 2022 and above require a global mark on managed assemblies.
+ # CMake adds this automatically when using COMMON_LANGUAGE_RUNTIME,
+ # but this test covers direct use of /clr.
+ set_property(TARGET ${PROJECT_NAME} PROPERTY VS_GLOBAL_ManagedAssembly "true")
+endif()
# Note: The property VS_GLOBAL_KEYWORD must be set.
set_property(TARGET ${PROJECT_NAME} PROPERTY VS_GLOBAL_KEYWORD "ManagedCProj")