Merge bitcoin/bitcoin#31503: cmake: Link bitcoin_consensus as a library

46e207d329 cmake: Link `bitcoin_consensus` as a library (Hennadii Stepanov)

Pull request description:

  The [`TARGET_OBJECTS`](https://cmake.org/cmake/help/latest/manual/cmake-generator-expressions.7.html#genex:TARGET_OBJECTS) generator expression was introduced in the staging branch when we aimed to build the libbitcoinconsensus shared library. However, `bitcoin_consensus` is a `STATIC` library, not an `OBJECT` library.

  This change updates the build system to link `bitcoin_consensus` normally to `test_bitcoin`, resolving [linking issues](https://github.com/bitcoin/bitcoin/issues/31456#issuecomment-2538798107) when building with clang-cl.

ACKs for top commit:
  TheCharlatan:
    ACK 46e207d329
  theuni:
    utACK 46e207d329

Tree-SHA512: b5400be8e8350f80c9fc8b66c4a22032a51578e409eb1817309116fbf0bddeb5fcadd5fda685c98859730ee6cc904adb29d54207387732c8b574a1feb2be906f
This commit is contained in:
merge-script 2024-12-17 10:52:22 +00:00
commit 58436d4af3
No known key found for this signature in database
GPG key ID: 2EEB9F5CC09526C1

View file

@ -18,7 +18,6 @@ generate_header_from_raw(data/asmap.raw test::data)
# SOURCES property is processed to gather test suite macros.
add_executable(test_bitcoin
main.cpp
$<TARGET_OBJECTS:bitcoin_consensus>
${CMAKE_CURRENT_BINARY_DIR}/data/asmap.raw.h
${CMAKE_CURRENT_BINARY_DIR}/data/base58_encode_decode.json.h
${CMAKE_CURRENT_BINARY_DIR}/data/bip341_wallet_vectors.json.h
@ -151,6 +150,7 @@ target_link_libraries(test_bitcoin
test_util
bitcoin_cli
bitcoin_node
bitcoin_consensus
minisketch
secp256k1
Boost::headers