mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-04-29 23:09:44 -04:00
cmake: Implement install
build target
This commit is contained in:
parent
84ac35cfd4
commit
973a3b0c5d
6 changed files with 46 additions and 0 deletions
|
@ -187,6 +187,8 @@ option(BUILD_BENCH "Build bench_bitcoin executable." OFF)
|
||||||
option(BUILD_FUZZ_BINARY "Build fuzz binary." OFF)
|
option(BUILD_FUZZ_BINARY "Build fuzz binary." OFF)
|
||||||
cmake_dependent_option(BUILD_FOR_FUZZING "Build for fuzzing. Enabling this will disable all other targets and override BUILD_FUZZ_BINARY." OFF "NOT MSVC" OFF)
|
cmake_dependent_option(BUILD_FOR_FUZZING "Build for fuzzing. Enabling this will disable all other targets and override BUILD_FUZZ_BINARY." OFF "NOT MSVC" OFF)
|
||||||
|
|
||||||
|
option(INSTALL_MAN "Install man pages." ON)
|
||||||
|
|
||||||
set(configure_warnings)
|
set(configure_warnings)
|
||||||
|
|
||||||
include(CheckPIESupported)
|
include(CheckPIESupported)
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
# Distributed under the MIT software license, see the accompanying
|
# Distributed under the MIT software license, see the accompanying
|
||||||
# file COPYING or https://opensource.org/license/mit/.
|
# 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)
|
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})
|
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)
|
if(ENABLE_WALLET)
|
||||||
add_subdirectory(wallet)
|
add_subdirectory(wallet)
|
||||||
|
|
||||||
|
@ -176,6 +179,7 @@ if(ENABLE_WALLET)
|
||||||
bitcoin_util
|
bitcoin_util
|
||||||
Boost::headers
|
Boost::headers
|
||||||
)
|
)
|
||||||
|
list(APPEND installable_targets bitcoin-wallet)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -304,6 +308,7 @@ if(BUILD_DAEMON)
|
||||||
bitcoin_node
|
bitcoin_node
|
||||||
$<TARGET_NAME_IF_EXISTS:bitcoin_wallet>
|
$<TARGET_NAME_IF_EXISTS:bitcoin_wallet>
|
||||||
)
|
)
|
||||||
|
list(APPEND installable_targets bitcoind)
|
||||||
endif()
|
endif()
|
||||||
if(WITH_MULTIPROCESS)
|
if(WITH_MULTIPROCESS)
|
||||||
add_executable(bitcoin-node
|
add_executable(bitcoin-node
|
||||||
|
@ -316,6 +321,7 @@ if(WITH_MULTIPROCESS)
|
||||||
bitcoin_ipc
|
bitcoin_ipc
|
||||||
$<TARGET_NAME_IF_EXISTS:bitcoin_wallet>
|
$<TARGET_NAME_IF_EXISTS:bitcoin_wallet>
|
||||||
)
|
)
|
||||||
|
list(APPEND installable_targets bitcoin-node)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
@ -340,6 +346,7 @@ if(BUILD_CLI)
|
||||||
bitcoin_util
|
bitcoin_util
|
||||||
$<TARGET_NAME_IF_EXISTS:libevent::libevent>
|
$<TARGET_NAME_IF_EXISTS:libevent::libevent>
|
||||||
)
|
)
|
||||||
|
list(APPEND installable_targets bitcoin-cli)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
@ -351,6 +358,7 @@ if(BUILD_TX)
|
||||||
bitcoin_util
|
bitcoin_util
|
||||||
univalue
|
univalue
|
||||||
)
|
)
|
||||||
|
list(APPEND installable_targets bitcoin-tx)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
@ -361,6 +369,7 @@ if(BUILD_UTIL)
|
||||||
bitcoin_common
|
bitcoin_common
|
||||||
bitcoin_util
|
bitcoin_util
|
||||||
)
|
)
|
||||||
|
list(APPEND installable_targets bitcoin-util)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
@ -406,3 +415,17 @@ endif()
|
||||||
if(BUILD_FUZZ_BINARY)
|
if(BUILD_FUZZ_BINARY)
|
||||||
add_subdirectory(test/fuzz)
|
add_subdirectory(test/fuzz)
|
||||||
endif()
|
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()
|
||||||
|
|
|
@ -79,3 +79,7 @@ endif()
|
||||||
add_test(NAME bench_sanity_check_high_priority
|
add_test(NAME bench_sanity_check_high_priority
|
||||||
COMMAND bench_bitcoin -sanity-check -priority-level=high
|
COMMAND bench_bitcoin -sanity-check -priority-level=high
|
||||||
)
|
)
|
||||||
|
|
||||||
|
install(TARGETS bench_bitcoin
|
||||||
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||||
|
)
|
||||||
|
|
|
@ -97,3 +97,10 @@ target_link_libraries(bitcoinkernel
|
||||||
set_target_properties(bitcoinkernel PROPERTIES
|
set_target_properties(bitcoinkernel PROPERTIES
|
||||||
CXX_VISIBILITY_PRESET default
|
CXX_VISIBILITY_PRESET default
|
||||||
)
|
)
|
||||||
|
|
||||||
|
include(GNUInstallDirs)
|
||||||
|
install(TARGETS bitcoinkernel
|
||||||
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||||
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
|
)
|
||||||
|
|
|
@ -255,11 +255,17 @@ if(WITH_MULTIPROCESS)
|
||||||
bitcoin_ipc
|
bitcoin_ipc
|
||||||
)
|
)
|
||||||
import_plugins(bitcoin-gui)
|
import_plugins(bitcoin-gui)
|
||||||
|
list(APPEND installable_targets bitcoin-gui)
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
set_target_properties(bitcoin-gui PROPERTIES WIN32_EXECUTABLE TRUE)
|
set_target_properties(bitcoin-gui PROPERTIES WIN32_EXECUTABLE TRUE)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
install(TARGETS ${installable_targets}
|
||||||
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||||
|
COMPONENT GUI
|
||||||
|
)
|
||||||
|
|
||||||
if(BUILD_GUI_TESTS)
|
if(BUILD_GUI_TESTS)
|
||||||
add_subdirectory(test)
|
add_subdirectory(test)
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -217,3 +217,7 @@ function(add_all_test_targets)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
add_all_test_targets()
|
add_all_test_targets()
|
||||||
|
|
||||||
|
install(TARGETS test_bitcoin
|
||||||
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||||
|
)
|
||||||
|
|
Loading…
Add table
Reference in a new issue