Skip to content

Commit 7290bc6

Browse files
committed
Merge bitcoin/bitcoin#31078: build: Fix kernel static lib component install
82e16e6 cmake: Refactor install kernel dependencies (Hennadii Stepanov) 42e6277 build: Add static libraries to Kernel install component (TheCharlatan) Pull request description: Fixes the installation of the pkgconfig file and the static library when installing only the `Kernel` component. This is a followup to fix #30835 and #30814, which were merged shortly after one another, but are interrelated. Can be tested with: ``` cmake -B build -DBUILD_SHARED_LIBS=OFF -DBUILD_KERNEL_LIB=ON cmake --build build --target bitcoinkernel cmake --install build --component Kernel ``` ACKs for top commit: hebasto: ACK 82e16e6, tested on Ubuntu 23.10. fanquake: ACK 82e16e6 Tree-SHA512: 07c18a341d4464e489c28fb262600338f1711248309ffb2af0ef3ab1abf06f10873c435895b63010e0be8e44af77046324896dfd872479792aa049831606dc45
2 parents 68f29b2 + 82e16e6 commit 7290bc6

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/kernel/CMakeLists.txt

+4-8
Original file line numberDiff line numberDiff line change
@@ -120,18 +120,14 @@ if(NOT BUILD_SHARED_LIBS)
120120
set(all_kernel_static_link_libs "")
121121
get_target_static_link_libs(bitcoinkernel all_kernel_static_link_libs)
122122

123+
install(TARGETS ${all_kernel_static_link_libs} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Kernel)
124+
list(TRANSFORM all_kernel_static_link_libs PREPEND "-l")
123125
# LIBS_PRIVATE is substituted in the pkg-config file.
124-
set(LIBS_PRIVATE "")
125-
foreach(lib ${all_kernel_static_link_libs})
126-
install(TARGETS ${lib} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
127-
string(APPEND LIBS_PRIVATE " -l${lib}")
128-
endforeach()
129-
130-
string(STRIP "${LIBS_PRIVATE}" LIBS_PRIVATE)
126+
list(JOIN all_kernel_static_link_libs " " LIBS_PRIVATE)
131127
endif()
132128

133129
configure_file(${PROJECT_SOURCE_DIR}/libbitcoinkernel.pc.in ${PROJECT_BINARY_DIR}/libbitcoinkernel.pc @ONLY)
134-
install(FILES ${PROJECT_BINARY_DIR}/libbitcoinkernel.pc DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
130+
install(FILES ${PROJECT_BINARY_DIR}/libbitcoinkernel.pc DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig" COMPONENT Kernel)
135131

136132
include(GNUInstallDirs)
137133
install(TARGETS bitcoinkernel

0 commit comments

Comments
 (0)