cmake: Fix CMAKE_HOST_SYSTEM_VERSION when built for MinGW

Due to #23244 our application manifest is not automatically embedded
when built with MinGW tools.  Embed it via an explicit resource file.

Also add `<trustInfo>` to the manifest because MinGW tooling does not
add it automatically as MSVC tooling does.

Fixes: #27152
Issue: #23244
This commit is contained in:
Alexey Rochev
2025-09-01 14:49:35 -04:00
committed by Brad King
parent 46fc0232ae
commit 5a919e6601
3 changed files with 14 additions and 1 deletions
+5 -1
View File
@@ -967,7 +967,11 @@ if(WIN32)
# Add a manifest file to executables on Windows to allow for
# GetVersion to work properly on Windows 8 and above.
target_sources(ManifestLib INTERFACE cmake.version.manifest)
if(MSVC)
target_sources(ManifestLib INTERFACE cmake.version.manifest)
else()
target_sources(ManifestLib INTERFACE cmake.version.manifest.rc)
endif()
endif()
endif()
+7
View File
@@ -20,4 +20,11 @@
<ws2:longPathAware>true</ws2:longPathAware>
</asmv3:windowsSettings>
</asmv3:application>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="asInvoker" uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>
+2
View File
@@ -0,0 +1,2 @@
#include <winuser.h>
CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "cmake.version.manifest"