Repository: bitcoin/bitcoin (language: cpp)

Issue:
build: Introduce "Kernel" installation component
This PR enables building and installing only `libbitcoinkernel`, without the need to disable other targets during the project build system generation:

```
$ rm -rf build && cmake -B build -DBUILD_KERNEL_LIB=ON
$ cmake --build build --target bitcoinkernel
$ cmake --install build --component Kernel --prefix /home/hebasto/INSTALL
-- Install configuration: "RelWithDebInfo"
-- Installing: /home/hebasto/INSTALL/lib/libbitcoinkernel.so
```

Please note, that only the `bitcoinkernel` target is being built.

Related to https://github.com/bitcoin/bitcoin/issues/30801 and https://github.com/bitcoin/bitcoin/pull/30814.


Discussion / hints:
<!--e57a25ab6845829454e8d69fc972939a-->

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

<!--006a51241073e994b41acfe9ec718e94-->
### Code Coverage
For detailed information about the code coverage, see the [test coverage report](https://corecheck.dev/bitcoin/bitcoin/pulls/30835).
<!--021abf342d371248e50ceaed478a90ca-->
### Reviews
See [the guideline](https://github.com/bitcoin/bitcoin/blob/master/CONTRIBUTING.md#code-review) for information on the review process.
| Type | Reviewers |
| ---- | --------- |
| ACK | [TheCharlatan](https://github.com/bitcoin/bitcoin/pull/30835#pullrequestreview-2287088274), [ryanofsky](https://github.com/bitcoin/bitcoin/pull/30835#pullrequestreview-2292601777) |

If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

cc @fanquake @ryanofsky 

Fix patch:
diff --git a/src/kernel/CMakeLists.txt b/src/kernel/CMakeLists.txt
index 7bf8efc516752..6ea16e8a42585 100644
--- a/src/kernel/CMakeLists.txt
+++ b/src/kernel/CMakeLists.txt
@@ -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


Test patch: