@@ -38,6 +38,7 @@ list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/module)
3838# Configurable options.
3939# When adding a new option, end the <help_text> with a full stop for consistency.
4040include (CMakeDependentOption)
41+ option (BUILD_DAEMON "Build bitcoind executable." ON )
4142option (ASM "Use assembly routines." ON )
4243cmake_dependent_option(CXX20 "Enable compilation in C++20 mode." OFF "NOT MSVC" ON )
4344
@@ -72,11 +73,50 @@ include(cmake/secp256k1.cmake)
7273include (CheckStdFilesystem)
7374check_std_filesystem()
7475
76+ find_package (PkgConfig)
77+ if (BUILD_DAEMON)
78+ set (THREADS_PREFER_PTHREAD_FLAG ON )
79+ find_package (Threads REQUIRED)
80+ if (NOT MINGW AND NOT CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" )
81+ target_compile_definitions (Threads::Threads INTERFACE
82+ $<$<COMPILE_FEATURES:cxx_thread_local>:HAVE_THREAD_LOCAL>
83+ )
84+ endif ()
85+
86+ if (APPLE )
87+ execute_process (
88+ COMMAND brew --prefix boost
89+ OUTPUT_VARIABLE BOOST_ROOT
90+ ERROR_QUIET
91+ OUTPUT_STRIP_TRAILING_WHITESPACE
92+ )
93+ endif ()
94+ set (Boost_NO_BOOST_CMAKE ON )
95+ # Find Boost headers only.
96+ find_package (Boost 1.64.0 REQUIRED)
97+ mark_as_advanced (Boost_INCLUDE_DIR)
98+ target_compile_definitions (Boost::boost INTERFACE
99+ $<$<CONFIG:Debug>:BOOST_MULTI_INDEX_ENABLE_SAFE_MODE>
100+ )
101+
102+ pkg_check_modules(libevent REQUIRED libevent>=2.1.8 IMPORTED_TARGET)
103+ target_link_libraries (PkgConfig::libevent INTERFACE
104+ $<$<PLATFORM_ID:Windows>:iphlpapi;ws2_32>
105+ )
106+ endif ()
107+
108+ if (NOT WIN32 AND BUILD_DAEMON)
109+ pkg_check_modules(libevent_pthreads REQUIRED libevent_pthreads>=2.1.8 IMPORTED_TARGET)
110+ endif ()
111+
75112add_subdirectory (src)
76113
77114message ("\n " )
78115message ("Configure summary" )
79116message ("=================" )
117+ message ("Executables:" )
118+ message (" bitcoind ............................ ${BUILD_DAEMON} " )
119+ message ("" )
80120get_directory_property (definitions COMPILE_DEFINITIONS )
81121string (REPLACE ";" " " definitions "${definitions} " )
82122message ("Preprocessor defined macros ........... ${definitions} " )
0 commit comments