From 654a4cf5e69c96c3244bc3727b8fdb054a1eff01 Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Thu, 9 Oct 2025 10:45:22 +0200 Subject: [PATCH] cmake: Use builtin support for .manifest files CMake ignores .rc and .manifest files when not building for WIN32. --- CMakeLists.txt | 4 ---- cmake/module/AddWindowsResources.cmake | 10 +++++++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fec2b1a3fa0..f36c4cd4b6a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -330,10 +330,6 @@ if(WIN32) /Zc:__cplusplus /sdl ) - target_link_options(core_interface INTERFACE - # We embed our own manifests. - /MANIFEST:NO - ) # Improve parallelism in MSBuild. # See: https://devblogs.microsoft.com/cppblog/improved-parallelism-in-msbuild/. list(APPEND CMAKE_VS_GLOBALS "UseMultiToolTask=true") diff --git a/cmake/module/AddWindowsResources.cmake b/cmake/module/AddWindowsResources.cmake index 84c1ba8565b..1cdcb6dfb27 100644 --- a/cmake/module/AddWindowsResources.cmake +++ b/cmake/module/AddWindowsResources.cmake @@ -13,12 +13,16 @@ endfunction() # Add a fusion manifest to Windows executables. # See: https://learn.microsoft.com/en-us/windows/win32/sbscs/application-manifests function(add_windows_application_manifest target) - if(WIN32) - configure_file(${PROJECT_SOURCE_DIR}/cmake/windows-app.manifest.in ${target}.manifest USE_SOURCE_PERMISSIONS) + configure_file(${PROJECT_SOURCE_DIR}/cmake/windows-app.manifest.in ${target}.manifest USE_SOURCE_PERMISSIONS) + if(MSVC) + target_sources(${target} PRIVATE ${target}.manifest) + else() + # TODO: Remove when upstream issue is fixed: + # https://gitlab.kitware.com/cmake/cmake/-/issues/23244 file(CONFIGURE OUTPUT ${target}-manifest.rc CONTENT "1 /* CREATEPROCESS_MANIFEST_RESOURCE_ID */ 24 /* RT_MANIFEST */ \"${target}.manifest\"" ) - add_windows_resources(${target} ${CMAKE_CURRENT_BINARY_DIR}/${target}-manifest.rc) + target_sources(${target} PRIVATE ${target}-manifest.rc) endif() endfunction()