aboutsummaryrefslogtreecommitdiff
path: root/src/CMakeLists.txt
diff options
context:
space:
mode:
authorHennadii Stepanov <32963518+hebasto@users.noreply.github.com>2024-07-24 12:29:12 +0100
committerHennadii Stepanov <32963518+hebasto@users.noreply.github.com>2024-08-16 21:19:11 +0100
commit973a3b0c5dcbf6b3fd155b2dda4c2e94a0b0ee5f (patch)
treeb514d11c15217400903355ba389930e2a510bba0 /src/CMakeLists.txt
parent84ac35cfd4dfa6f235f6e5a00b571846358f45ce (diff)
downloadbitcoin-973a3b0c5dcbf6b3fd155b2dda4c2e94a0b0ee5f.tar.xz
cmake: Implement `install` build target
Diffstat (limited to 'src/CMakeLists.txt')
-rw-r--r--src/CMakeLists.txt23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index ba2beba472..4f6c025086 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -2,6 +2,8 @@
# Distributed under the MIT software license, see the accompanying
# file COPYING or https://opensource.org/license/mit/.
+include(GNUInstallDirs)
+
configure_file(${PROJECT_SOURCE_DIR}/cmake/bitcoin-config.h.in config/bitcoin-config.h @ONLY)
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
@@ -160,6 +162,7 @@ target_link_libraries(bitcoin_common
)
+set(installable_targets)
if(ENABLE_WALLET)
add_subdirectory(wallet)
@@ -176,6 +179,7 @@ if(ENABLE_WALLET)
bitcoin_util
Boost::headers
)
+ list(APPEND installable_targets bitcoin-wallet)
endif()
endif()
@@ -304,6 +308,7 @@ if(BUILD_DAEMON)
bitcoin_node
$<TARGET_NAME_IF_EXISTS:bitcoin_wallet>
)
+ list(APPEND installable_targets bitcoind)
endif()
if(WITH_MULTIPROCESS)
add_executable(bitcoin-node
@@ -316,6 +321,7 @@ if(WITH_MULTIPROCESS)
bitcoin_ipc
$<TARGET_NAME_IF_EXISTS:bitcoin_wallet>
)
+ list(APPEND installable_targets bitcoin-node)
endif()
@@ -340,6 +346,7 @@ if(BUILD_CLI)
bitcoin_util
$<TARGET_NAME_IF_EXISTS:libevent::libevent>
)
+ list(APPEND installable_targets bitcoin-cli)
endif()
@@ -351,6 +358,7 @@ if(BUILD_TX)
bitcoin_util
univalue
)
+ list(APPEND installable_targets bitcoin-tx)
endif()
@@ -361,6 +369,7 @@ if(BUILD_UTIL)
bitcoin_common
bitcoin_util
)
+ list(APPEND installable_targets bitcoin-util)
endif()
@@ -406,3 +415,17 @@ endif()
if(BUILD_FUZZ_BINARY)
add_subdirectory(test/fuzz)
endif()
+
+
+install(TARGETS ${installable_targets}
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+)
+unset(installable_targets)
+
+if(INSTALL_MAN)
+ # TODO: these stubs are no longer needed. man pages should be generated at install time.
+ install(DIRECTORY ../doc/man/
+ DESTINATION ${CMAKE_INSTALL_MANDIR}/man1
+ FILES_MATCHING PATTERN *.1
+ )
+endif()