Skip to content

Commit abeebcc

Browse files
committed
Merge bitcoin/bitcoin#31357: cmake: Improve build script correctness
ab5c63e cmake: Build `secp256k1` only when required (Hennadii Stepanov) 76a3a54 cmake: Ensure script correctness when no targets are specified (Hennadii Stepanov) Pull request description: When no build targets are specified, it is reasonable to expect the configuration step to succeed and produce a build system that does not build any targets. This PR updates the code to ensure this behaviour: ``` $ cmake -B build -G "Ninja" -DBUILD_DAEMON=OFF -DBUILD_CLI=OFF -DBUILD_TX=OFF -DBUILD_UTIL=OFF -DENABLE_WALLET=OFF -DBUILD_TESTS=OFF $ cmake --build build ninja: no work to do. ``` ACKs for top commit: TheCharlatan: ACK ab5c63e tdb3: light test ACK ab5c63e Tree-SHA512: 1b13f406c58b02768d9ba831413aeae1d7e03659e7101de8e598f906ba220f479ac06707965c96a14468ce4ba49011a1ab9adee9cee34ab1e8622f690b94dad8
2 parents 4c9b138 + ab5c63e commit abeebcc

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/CMakeLists.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ if(DEFINED ENV{CFLAGS})
7373
endif()
7474
set(CMAKE_EXPORT_COMPILE_COMMANDS OFF)
7575
add_subdirectory(secp256k1)
76+
set_target_properties(secp256k1 PROPERTIES
77+
EXCLUDE_FROM_ALL TRUE
78+
)
7679
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
7780
string(APPEND CMAKE_C_COMPILE_OBJECT " ${APPEND_CPPFLAGS} ${APPEND_CFLAGS}")
7881

@@ -296,8 +299,8 @@ target_link_libraries(bitcoin_node
296299
minisketch
297300
univalue
298301
Boost::headers
299-
libevent::core
300-
libevent::extra
302+
$<TARGET_NAME_IF_EXISTS:libevent::core>
303+
$<TARGET_NAME_IF_EXISTS:libevent::extra>
301304
$<TARGET_NAME_IF_EXISTS:libevent::pthreads>
302305
$<TARGET_NAME_IF_EXISTS:USDT::headers>
303306
)

0 commit comments

Comments
 (0)