Bläddra i källkod

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
Alexey Rochev 1 månad sedan
förälder
incheckning
5a919e6601
3 ändrade filer med 14 tillägg och 1 borttagningar
  1. 5 1
      Source/CMakeLists.txt
  2. 7 0
      Source/cmake.version.manifest
  3. 2 0
      Source/cmake.version.manifest.rc

+ 5 - 1
Source/CMakeLists.txt

@@ -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 - 0
Source/cmake.version.manifest

@@ -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 - 0
Source/cmake.version.manifest.rc

@@ -0,0 +1,2 @@
+#include <winuser.h>
+CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "cmake.version.manifest"