cmake: Combine installed packages #98

pull ryanofsky wants to merge 2 commits into bitcoin-core:master from ryanofsky:pr/cpkg changing 6 files +149 −83
  1. ryanofsky commented at 6:38 PM on April 1, 2024: collaborator

    This change combines previous installed:

    • cmake/LibmultiprocessLibConfig.cmake
    • cmake/LibmultiprocessBinConfig.cmake

    files into a single:

    • cmake/Libmultiprocess/LibmultiprocessConfig.cmake

    file, so it can be imported with find_package(Libmultiprocess).

    The previous locations which were set in https://github.com/chaincodelabs/libmultiprocess/pull/97 were not compatible with find_package search behavior by default.

    The change also adds some documentation about using the new package to doc/install.md.

  2. cmake: CMakeLists.txt cleanup
    Move code and add comments, no substantive changes.
    2ed1e9aedb
  3. cmake: Combine installed packages
    This change combines previous installed "cmake/LibmultiprocessLibConfig.cmake"
    and "cmake/LibmultiprocessBinConfig.cmake" files into a single
    "cmake/Libmultiprocess/LibmultiprocessConfig.cmake" file, so it can be imported
    with "find_package(Libmultiprocess)". The previous locations which were set in
    https://github.com/chaincodelabs/libmultiprocess/pull/97 were not actually
    compatible with find_package search behavior by default.
    
    The change also adds some documentation about using the new package to
    doc/install.md.
    dc9b4e6a99
  4. ryanofsky merged this on Apr 1, 2024
  5. ryanofsky closed this on Apr 1, 2024

  6. hebasto commented at 7:43 PM on April 1, 2024: member

    I did not test this PR yet, but have a question regarding the combined package configuration.

    In the Bitcoin Core depends, how does it suppose to work considering that the mpgen tool is installed in the native subdirectory of the depends prefix?

  7. ryanofsky commented at 8:33 PM on April 1, 2024: collaborator

    I'm not sure exactly, but I'd imagine you'd just find the package twice with different components instead of finding two packages separately. Even before this PR you would need to point cmake at the native directory to find the code generation package, so I don't think that aspect is changing.

  8. ryanofsky commented at 8:55 PM on April 1, 2024: collaborator

    Or if the issue is that cmake doesn't allow importing two packages with the same name, maybe a good solution would be to add an option here controlling the installed package name.

    If multiple libmultiprocess builds are installed (native and cross-compiled) it seems good if they are all allowed to be full installs, and downstream cmake projects can choose which components of each install to use. Even though depends system only does half-builds for efficiency (executable only or library only), this doesn't seem like something that should be required for other builds.

  9. ryanofsky referenced this in commit 3e6c61fdc2 on Jun 13, 2024
  10. ryanofsky referenced this in commit eecd63c8e2 on Jul 11, 2024
  11. ryanofsky referenced this in commit e58937ea45 on Jul 12, 2024
  12. ryanofsky referenced this in commit 48a2fc6fb1 on Jul 16, 2024
  13. ryanofsky referenced this in commit 8574f79db9 on Jul 16, 2024
  14. Sjors referenced this in commit c2dbbc5fb7 on Jul 17, 2024
  15. Sjors referenced this in commit fa0a0fa537 on Jul 17, 2024
  16. Sjors referenced this in commit 10100360b6 on Jul 18, 2024
  17. Sjors referenced this in commit 39c615dbdc on Jul 18, 2024
  18. ryanofsky referenced this in commit 33e86e04d1 on Jul 18, 2024
  19. ryanofsky referenced this in commit b3a5eb738f on Jul 18, 2024
  20. Sjors referenced this in commit 3cfcac15ba on Jul 19, 2024
  21. fanquake referenced this in commit efeb39785a on Jul 20, 2024
  22. hebasto commented at 5:27 PM on July 20, 2024: member

    I'm not sure exactly, but I'd imagine you'd just find the package twice with different components instead of finding two packages separately.

    Once a package found, the ${PACKAGE}_DIR variable is cached.

    Therefore, to work with Bitcoin Core's depends, the code as follows should be used:

    find_package(Libmultiprocess COMPONENTS Lib)
    unset(Libmultiprocess_DIR CACHE)
    find_package(Libmultiprocess COMPONENTS Bin
      NO_CMAKE_FIND_ROOT_PATH
      PATHS ${CMAKE_FIND_ROOT_PATH}/native
    )
    

    But this approach undermines the user's ability to specify non-standard package component locations because the Libmultiprocess_DIR variable is overloaded.

    Or if the issue is that cmake doesn't allow importing two packages with the same name, maybe a good solution would be to add an option here controlling the installed package name.

    If such an option will be leveraged by depends, Bitcoin Core probably will fail to find the Libmultiprocess package provided by other means.

  23. ryanofsky commented at 8:23 PM on July 22, 2024: collaborator

    re: https://github.com/chaincodelabs/libmultiprocess/pull/98#issuecomment-2241236657 @hebasto can you use the find_package NAMES option to give the packages different names? From the find_package documentation:

    A cache entry called <PackageName>_DIR is created to hold the directory containing the file. By default, the command searches for a package with the name <PackageName>. If the NAMES option is given, the names following it are used instead of <PackageName>.

    So modifying your example above, you could write:

    find_package(Libmultiprocess COMPONENTS Lib)
    find_package(LibmultiprocessNative COMPONENTS Bin
      NAMES Libmultiprocess
      NO_CMAKE_FIND_ROOT_PATH
      PATHS ${CMAKE_FIND_ROOT_PATH}/native
    )
    

    This should result in separate Libmultiprocess_DIR and LibmultiprocessNative_DIR variables

  24. hebasto commented at 11:53 AM on July 23, 2024: member

    @ryanofsky

    can you use the find_package NAMES option to give the packages different names? From the find_package documentation:

    Thank you! The suggested approach looks nice to me.

    It only requires a bugfix suggested in https://github.com/chaincodelabs/libmultiprocess/pull/103.

  25. ryanofsky referenced this in commit e4540729c9 on Jul 23, 2024
  26. ryanofsky referenced this in commit 261395944e on Jul 24, 2024
  27. ryanofsky referenced this in commit c030548f20 on Jul 26, 2024
  28. ryanofsky referenced this in commit ebe93a5d0a on Sep 26, 2024
  29. PastaPastaPasta referenced this in commit ec5338c480 on Sep 27, 2024
  30. PastaPastaPasta referenced this in commit c1ca6f2fa1 on Sep 27, 2024
  31. PastaPastaPasta referenced this in commit a6e391d6bc on Sep 27, 2024
  32. PastaPastaPasta referenced this in commit 2e970728be on Sep 28, 2024
  33. PastaPastaPasta referenced this in commit d46e16c023 on Oct 1, 2024
  34. bitcoin-core locked this on Jul 23, 2025
Contributors

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin-core/libmultiprocess. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-18 15:30 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me