22# Distributed under the MIT software license, see the accompanying
33# file COPYING or http://www.opensource.org/licenses/mit-license.php.
44
5+ include (GNUInstallDirs)
6+
57configure_file (${CMAKE_SOURCE_DIR} /cmake/bitcoin-config.h.in config/bitcoin-config.h @ONLY)
68add_compile_definitions (HAVE_CONFIG_H)
79include_directories (${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} )
@@ -101,6 +103,7 @@ target_link_libraries(bitcoin_common
101103)
102104
103105
106+ set (installable_targets)
104107if (ENABLE_WALLET)
105108 add_subdirectory (wallet)
106109
@@ -117,6 +120,7 @@ if(ENABLE_WALLET)
117120 bitcoin_util
118121 Boost::headers
119122 )
123+ list (APPEND installable_targets bitcoin-wallet)
120124 endif ()
121125endif ()
122126
@@ -246,6 +250,7 @@ if(BUILD_DAEMON)
246250 core
247251 bitcoin_node
248252 )
253+ list (APPEND installable_targets bitcoind)
249254endif ()
250255
251256
@@ -270,6 +275,7 @@ if(BUILD_CLI)
270275 bitcoin_util
271276 libevent::libevent
272277 )
278+ list (APPEND installable_targets bitcoin-cli)
273279endif ()
274280
275281
@@ -281,6 +287,7 @@ if(BUILD_TX)
281287 bitcoin_util
282288 univalue
283289 )
290+ list (APPEND installable_targets bitcoin-tx)
284291endif ()
285292
286293
@@ -291,6 +298,7 @@ if(BUILD_UTIL)
291298 bitcoin_common
292299 bitcoin_util
293300 )
301+ list (APPEND installable_targets bitcoin-util)
294302endif ()
295303
296304
@@ -307,3 +315,16 @@ endif()
307315if (BUILD_TESTS)
308316 add_subdirectory (test )
309317endif ()
318+
319+
320+ install (TARGETS ${installable_targets}
321+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
322+ )
323+ unset (installable_targets)
324+
325+ if (INSTALL_MAN)
326+ install (DIRECTORY ../doc /man/
327+ DESTINATION ${CMAKE_INSTALL_MANDIR} /man1
328+ FILES_MATCHING PATTERN *.1
329+ )
330+ endif ()
0 commit comments