Skip to content

Commit 12fa951

Browse files
committed
build: simplify dependency graph
Allow the objects of static libs to be built in parallel rather than serially based on their dependency ordering. For more detail, see: https://cmake.org/cmake/help/latest/prop_tgt/OPTIMIZE_DEPENDENCIES.html
1 parent c4e4983 commit 12fa951

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,13 @@ set(CMAKE_CXX_EXTENSIONS OFF)
7171

7272
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/module)
7373

74+
# Flatten static lib dependencies.
75+
# Without this, if libfoo.a depends on libbar.a, libfoo's objects can't begin
76+
# to be compiled until libbar.a has been created.
77+
if (NOT DEFINED CMAKE_OPTIMIZE_DEPENDENCIES)
78+
set(CMAKE_OPTIMIZE_DEPENDENCIES TRUE)
79+
endif()
80+
7481
#=============================
7582
# Configurable options
7683
#=============================

cmake/minisketch.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ add_library(minisketch STATIC EXCLUDE_FROM_ALL
7474
${PROJECT_SOURCE_DIR}/src/minisketch/src/fields/generic_8bytes.cpp
7575
)
7676

77+
# Workaround for https://gitlab.kitware.com/cmake/cmake/-/issues/24058
78+
set_target_properties(minisketch PROPERTIES OPTIMIZE_DEPENDENCIES OFF)
79+
7780
target_include_directories(minisketch
7881
PUBLIC
7982
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/src/minisketch/include>

src/util/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ 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+
3942
target_link_libraries(bitcoin_util
4043
PRIVATE
4144
core_interface

0 commit comments

Comments
 (0)