diff options
Diffstat (limited to 'src/CMakeLists.txt')
-rw-r--r-- | src/CMakeLists.txt | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 895c17541f..4a86465bba 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -5,26 +5,18 @@ include(GNUInstallDirs) include(AddWindowsResources) -configure_file(${PROJECT_SOURCE_DIR}/cmake/bitcoin-config.h.in config/bitcoin-config.h USE_SOURCE_PERMISSIONS @ONLY) +configure_file(${PROJECT_SOURCE_DIR}/cmake/bitcoin-build-config.h.in bitcoin-build-config.h USE_SOURCE_PERMISSIONS @ONLY) include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) -# TODO: After the transition from Autotools to CMake, the obj/ subdirectory -# could be dropped as its only purpose was to separate a generated header -# from source files. add_custom_target(generate_build_info - BYPRODUCTS ${PROJECT_BINARY_DIR}/src/obj/build.h - COMMAND ${CMAKE_COMMAND} -E make_directory ${PROJECT_BINARY_DIR}/src/obj - COMMAND ${CMAKE_COMMAND} -DBUILD_INFO_HEADER_PATH=${PROJECT_BINARY_DIR}/src/obj/build.h -DSOURCE_DIR=${PROJECT_SOURCE_DIR} -P ${PROJECT_SOURCE_DIR}/cmake/script/GenerateBuildInfo.cmake - COMMENT "Generating obj/build.h" + BYPRODUCTS ${PROJECT_BINARY_DIR}/src/bitcoin-build-info.h + COMMAND ${CMAKE_COMMAND} -DBUILD_INFO_HEADER_PATH=${PROJECT_BINARY_DIR}/src/bitcoin-build-info.h -DSOURCE_DIR=${PROJECT_SOURCE_DIR} -P ${PROJECT_SOURCE_DIR}/cmake/script/GenerateBuildInfo.cmake + COMMENT "Generating bitcoin-build-info.h" VERBATIM ) add_library(bitcoin_clientversion OBJECT EXCLUDE_FROM_ALL clientversion.cpp ) -target_compile_definitions(bitcoin_clientversion - PRIVATE - HAVE_BUILD_INFO -) target_link_libraries(bitcoin_clientversion PRIVATE core_interface @@ -122,6 +114,8 @@ add_library(bitcoin_common STATIC EXCLUDE_FROM_ALL common/init.cpp common/interfaces.cpp common/messages.cpp + common/netif.cpp + common/pcp.cpp common/run_command.cpp common/settings.cpp common/signmessage.cpp @@ -300,7 +294,6 @@ target_link_libraries(bitcoin_node Boost::headers $<TARGET_NAME_IF_EXISTS:libevent::libevent> $<TARGET_NAME_IF_EXISTS:libevent::pthreads> - $<TARGET_NAME_IF_EXISTS:NATPMP::NATPMP> $<TARGET_NAME_IF_EXISTS:MiniUPnPc::MiniUPnPc> $<TARGET_NAME_IF_EXISTS:bitcoin_zmq> $<TARGET_NAME_IF_EXISTS:USDT::headers> @@ -333,6 +326,22 @@ if(WITH_MULTIPROCESS) $<TARGET_NAME_IF_EXISTS:bitcoin_wallet> ) list(APPEND installable_targets bitcoin-node) + + if(BUILD_TESTS) + # bitcoin_ipc_test library target is defined here in src/CMakeLists.txt + # instead of src/test/CMakeLists.txt so capnp files in src/test/ are able to + # reference capnp files in src/ipc/capnp/ by relative path. The Cap'n Proto + # compiler only allows importing by relative path when the importing and + # imported files are underneath the same compilation source prefix, so the + # source prefix must be src/, not src/test/ + add_library(bitcoin_ipc_test STATIC EXCLUDE_FROM_ALL + test/ipc_test.cpp + ) + target_capnp_sources(bitcoin_ipc_test ${PROJECT_SOURCE_DIR} + test/ipc_test.capnp + ) + add_dependencies(bitcoin_ipc_test bitcoin_ipc_headers) + endif() endif() |