Skip to content

Commit 3fd64ef

Browse files
committed
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.
1 parent 28dec6c commit 3fd64ef

File tree

2 files changed

+1
-4
lines changed

2 files changed

+1
-4
lines changed

src/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ add_custom_target(generate_build_info
1313
COMMENT "Generating bitcoin-build-info.h"
1414
VERBATIM
1515
)
16-
add_library(bitcoin_clientversion OBJECT EXCLUDE_FROM_ALL
16+
add_library(bitcoin_clientversion STATIC EXCLUDE_FROM_ALL
1717
clientversion.cpp
1818
)
1919
target_link_libraries(bitcoin_clientversion

src/util/CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,6 @@ add_library(bitcoin_util STATIC EXCLUDE_FROM_ALL
3636
../sync.cpp
3737
)
3838

39-
# Workaround for https://gitlab.kitware.com/cmake/cmake/-/issues/24058
40-
set_target_properties(bitcoin_util PROPERTIES OPTIMIZE_DEPENDENCIES OFF)
41-
4239
target_link_libraries(bitcoin_util
4340
PRIVATE
4441
core_interface

0 commit comments

Comments
 (0)