mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-07-07 08:50:26 +02:00
cmake: Add application manifests when cross-compiling for Windows
Windows application manifests provide several benefits. However, on the master branch, the linker generates and embeds manifests only when building with MSVC. This change unifies manifest embedding for both native and cross-compilation.
This commit is contained in:
@ -4,11 +4,24 @@
|
||||
|
||||
include_guard(GLOBAL)
|
||||
|
||||
macro(add_windows_resources target rc_file)
|
||||
function(add_windows_resources target rc_file)
|
||||
if(WIN32)
|
||||
target_sources(${target} PRIVATE ${rc_file})
|
||||
set_property(SOURCE ${rc_file}
|
||||
APPEND PROPERTY COMPILE_DEFINITIONS WINDRES_PREPROC
|
||||
)
|
||||
endif()
|
||||
endmacro()
|
||||
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)
|
||||
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)
|
||||
endif()
|
||||
endfunction()
|
||||
|
Reference in New Issue
Block a user