Skip to content

Commit

Permalink
cmake: Add AddWindowsResources module
Browse files Browse the repository at this point in the history
  • Loading branch information
hebasto committed Feb 1, 2024
1 parent 5ccc4c8 commit a7955b5
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
14 changes: 14 additions & 0 deletions cmake/module/AddWindowsResources.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright (c) 2024-present The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or https://opensource.org/license/mit/.

include_guard(GLOBAL)

macro(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()
6 changes: 6 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# file COPYING or http://www.opensource.org/licenses/mit-license.php.

include(GNUInstallDirs)
include(AddWindowsResources)

configure_file(${CMAKE_SOURCE_DIR}/cmake/bitcoin-config.h.in config/bitcoin-config.h @ONLY)
add_compile_definitions(HAVE_CONFIG_H)
Expand Down Expand Up @@ -141,6 +142,7 @@ if(ENABLE_WALLET)
init/bitcoin-wallet.cpp
wallet/wallettool.cpp
)
add_windows_resources(bitcoin-wallet bitcoin-wallet-res.rc)
target_link_libraries(bitcoin-wallet
core_interface
bitcoin_wallet
Expand Down Expand Up @@ -270,6 +272,7 @@ if(BUILD_DAEMON)
bitcoind.cpp
init/bitcoind.cpp
)
add_windows_resources(bitcoind bitcoind-res.rc)
target_link_libraries(bitcoind
core_interface
bitcoin_node
Expand All @@ -293,6 +296,7 @@ target_link_libraries(bitcoin_cli
# Bitcoin Core RPC client
if(BUILD_CLI)
add_executable(bitcoin-cli bitcoin-cli.cpp)
add_windows_resources(bitcoin-cli bitcoin-cli-res.rc)
target_link_libraries(bitcoin-cli
core_interface
bitcoin_cli
Expand All @@ -306,6 +310,7 @@ endif()

if(BUILD_TX)
add_executable(bitcoin-tx bitcoin-tx.cpp)
add_windows_resources(bitcoin-tx bitcoin-tx-res.rc)
target_link_libraries(bitcoin-tx
core_interface
bitcoin_common
Expand All @@ -318,6 +323,7 @@ endif()

if(BUILD_UTIL)
add_executable(bitcoin-util bitcoin-util.cpp)
add_windows_resources(bitcoin-util bitcoin-util-res.rc)
target_link_libraries(bitcoin-util
core_interface
bitcoin_common
Expand Down
2 changes: 2 additions & 0 deletions src/qt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@ add_executable(bitcoin-qt
../init/bitcoin-qt.cpp
)

add_windows_resources(bitcoin-qt res/bitcoin-qt-res.rc)

target_link_libraries(bitcoin-qt
core_interface
bitcoinqt
Expand Down

0 comments on commit a7955b5

Please sign in to comment.