Skip to content

Commit

Permalink
Merge bitcoin/bitcoin#31078: build: Fix kernel static lib component i…
Browse files Browse the repository at this point in the history
…nstall

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
  • Loading branch information
fanquake committed Oct 24, 2024
2 parents 68f29b2 + 82e16e6 commit 7290bc6
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/kernel/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -120,18 +120,14 @@ if(NOT BUILD_SHARED_LIBS)
set(all_kernel_static_link_libs "")
get_target_static_link_libs(bitcoinkernel all_kernel_static_link_libs)

install(TARGETS ${all_kernel_static_link_libs} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Kernel)
list(TRANSFORM all_kernel_static_link_libs PREPEND "-l")
# LIBS_PRIVATE is substituted in the pkg-config file.
set(LIBS_PRIVATE "")
foreach(lib ${all_kernel_static_link_libs})
install(TARGETS ${lib} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
string(APPEND LIBS_PRIVATE " -l${lib}")
endforeach()

string(STRIP "${LIBS_PRIVATE}" LIBS_PRIVATE)
list(JOIN all_kernel_static_link_libs " " LIBS_PRIVATE)
endif()

configure_file(${PROJECT_SOURCE_DIR}/libbitcoinkernel.pc.in ${PROJECT_BINARY_DIR}/libbitcoinkernel.pc @ONLY)
install(FILES ${PROJECT_BINARY_DIR}/libbitcoinkernel.pc DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
install(FILES ${PROJECT_BINARY_DIR}/libbitcoinkernel.pc DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig" COMPONENT Kernel)

include(GNUInstallDirs)
install(TARGETS bitcoinkernel
Expand Down

0 comments on commit 7290bc6

Please sign in to comment.