diff options
author | Brad King <brad.king@kitware.com> | 2021-09-15 14:53:45 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2021-09-15 17:19:37 (GMT) |
commit | f200f4d5a774ef83a938f0d99f80c2c8c83276b1 (patch) | |
tree | 91d976155878d3a9d29e72738c755febc99ee2ee /Tests/VSWindowsFormsResx | |
parent | d2a5fef985c03e347872d3b0bc7e9c311eac8fc5 (diff) | |
download | CMake-f200f4d5a774ef83a938f0d99f80c2c8c83276b1.zip CMake-f200f4d5a774ef83a938f0d99f80c2c8c83276b1.tar.gz CMake-f200f4d5a774ef83a938f0d99f80c2c8c83276b1.tar.bz2 |
VS: Fix managed C++ project generation for VS 2022
VS 2022 expects managed `.vcxproj` files to have a `ManagedAssembly`
element.
Fixes: #22583
Diffstat (limited to 'Tests/VSWindowsFormsResx')
-rw-r--r-- | Tests/VSWindowsFormsResx/CMakeLists.txt | 6 |
1 files changed, 6 insertions, 0 deletions
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") |