cmake: Avoid using OBJECT libraries

`OBJECT` libraries have historically exhibited poor support for various
features, both in the past and now. For example, see one of the latest
issues:
- https://gitlab.kitware.com/cmake/cmake/-/issues/24058

Furthermore, CMake maintainers have acknowledged:
> In general, however, where there is a choice, static libraries will
> typically be the more convenient choice in CMake projects.

This change:
1. Converts the `bitcoin_clientversion` library from an `OBJECT` library
   to a `STATIC` library.
2. Removes an obsolete workaround.
This commit is contained in:
Hennadii Stepanov 2025-02-18 12:29:18 +00:00
parent 28dec6c5f8
commit 3fd64efb43
No known key found for this signature in database
GPG key ID: 410108112E7EA81F
2 changed files with 1 additions and 4 deletions

View file

@ -13,7 +13,7 @@ add_custom_target(generate_build_info
COMMENT "Generating bitcoin-build-info.h"
VERBATIM
)
add_library(bitcoin_clientversion OBJECT EXCLUDE_FROM_ALL
add_library(bitcoin_clientversion STATIC EXCLUDE_FROM_ALL
clientversion.cpp
)
target_link_libraries(bitcoin_clientversion

View file

@ -36,9 +36,6 @@ add_library(bitcoin_util STATIC EXCLUDE_FROM_ALL
../sync.cpp
)
# Workaround for https://gitlab.kitware.com/cmake/cmake/-/issues/24058
set_target_properties(bitcoin_util PROPERTIES OPTIMIZE_DEPENDENCIES OFF)
target_link_libraries(bitcoin_util
PRIVATE
core_interface