/ cmake / module / AddWindowsResources.cmake
AddWindowsResources.cmake
 1  # Copyright (c) 2024-present The Bitcoin Core developers
 2  # Distributed under the MIT software license, see the accompanying
 3  # file COPYING or https://opensource.org/license/mit/.
 4  
 5  include_guard(GLOBAL)
 6  
 7  function(add_windows_resources target rc_file)
 8    if(WIN32)
 9      target_sources(${target} PRIVATE ${rc_file})
10    endif()
11  endfunction()
12  
13  # Add a fusion manifest to Windows executables.
14  # See: https://learn.microsoft.com/en-us/windows/win32/sbscs/application-manifests
15  function(add_windows_application_manifest target)
16    if(WIN32)
17      configure_file(${PROJECT_SOURCE_DIR}/cmake/windows-app.manifest.in ${target}.manifest USE_SOURCE_PERMISSIONS)
18      file(CONFIGURE
19        OUTPUT ${target}-manifest.rc
20        CONTENT "1 /* CREATEPROCESS_MANIFEST_RESOURCE_ID */ 24 /* RT_MANIFEST */ \"${target}.manifest\""
21      )
22      add_windows_resources(${target} ${CMAKE_CURRENT_BINARY_DIR}/${target}-manifest.rc)
23    endif()
24  endfunction()