@@ -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
@@ -87,14 +88,53 @@ include(cmake/secp256k1.cmake)
8788include (CheckStdFilesystem)
8889check_std_filesystem()
8990
90- set (THREADS_PREFER_PTHREAD_FLAG ON )
91- find_package (Threads REQUIRED)
91+ find_package (PkgConfig)
92+ if (BUILD_DAEMON)
93+ set (THREADS_PREFER_PTHREAD_FLAG ON )
94+ find_package (Threads REQUIRED)
95+ if (NOT MINGW AND NOT CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" )
96+ target_compile_definitions (Threads::Threads INTERFACE
97+ $<$<COMPILE_FEATURES:cxx_thread_local>:HAVE_THREAD_LOCAL>
98+ )
99+ endif ()
100+
101+ if (APPLE AND BREW_COMMAND)
102+ execute_process (
103+ COMMAND ${BREW_COMMAND} --prefix boost
104+ OUTPUT_VARIABLE BOOST_ROOT
105+ ERROR_QUIET
106+ OUTPUT_STRIP_TRAILING_WHITESPACE
107+ )
108+ endif ()
109+ set (Boost_NO_BOOST_CMAKE ON )
110+ # Find Boost headers only.
111+ find_package (Boost 1.64.0 REQUIRED)
112+ mark_as_advanced (Boost_INCLUDE_DIR)
113+ target_compile_definitions (Boost::boost INTERFACE
114+ $<$<CONFIG:Debug>:BOOST_MULTI_INDEX_ENABLE_SAFE_MODE>
115+ )
116+ if (CMAKE_VERSION VERSION_LESS 3.15)
117+ add_library (Boost::headers ALIAS Boost::boost)
118+ endif ()
119+
120+ pkg_check_modules(libevent REQUIRED libevent>=2.1.8 IMPORTED_TARGET)
121+ target_link_libraries (PkgConfig::libevent INTERFACE
122+ $<$<PLATFORM_ID:Windows>:iphlpapi;ws2_32>
123+ )
124+ endif ()
125+
126+ if (NOT WIN32 AND BUILD_DAEMON)
127+ pkg_check_modules(libevent_pthreads REQUIRED libevent_pthreads>=2.1.8 IMPORTED_TARGET)
128+ endif ()
92129
93130add_subdirectory (src)
94131
95132message ("\n " )
96133message ("Configure summary" )
97134message ("=================" )
135+ message ("Executables:" )
136+ message (" bitcoind ............................ ${BUILD_DAEMON} " )
137+ message ("" )
98138get_directory_property (definitions COMPILE_DEFINITIONS )
99139string (REPLACE ";" " " definitions "${definitions} " )
100140message ("Preprocessor defined macros ........... ${definitions} " )
0 commit comments