Skip to content

Feature/brush up cmake - #364

Open
KIwabuchi wants to merge 2 commits into
developfrom
feature/brush_up_cmake
Open

Feature/brush up cmake#364
KIwabuchi wants to merge 2 commits into
developfrom
feature/brush_up_cmake

Conversation

@KIwabuchi

@KIwabuchi KIwabuchi commented Jul 23, 2026

Copy link
Copy Markdown
Member

This pull request significantly improves how the Metall CMake build system manages dependencies, especially Boost and Threads, and modernizes the way executable targets are set up. The changes make Metall easier to consume from both build trees and installed packages, reduce manual dependency management for users, and refactor helper logic for maintainability.

The most important changes are:

Dependency Management Improvements:

  • The main CMakeLists.txt now automatically attaches required C++ standard, Boost, and Threads dependencies to the Metall::Metall target, so consumers no longer need to manually specify include directories or link libraries—these are inherited transitively. This includes proper handling for older and newer CMake versions, and for both build-tree and installed usage. [1] [2] [3]
  • Lightweight dependency discovery and linking logic for Boost and Threads are added to ensure correct usage requirements are set up whether Boost is found via CMake targets or by include path. [1] [2]
  • Helper functions are introduced in cmake/metall_target_helpers.cmake to encapsulate logic for propagating include directories, compile definitions, and for converting local targets into export-safe link items.

CMake Helper Refactoring:

  • The logic for setting up compile options and linking dependencies for executables is moved from inline CMake functions in CMakeLists.txt to a new cmake/metall_executable_helpers.cmake, making the build scripts more modular and easier to maintain. [1] [2]

Example and Documentation Updates:

  • Example CMake projects (example/cmake/FetchContent/CMakeLists.txt and example/cmake/find_package/CMakeLists.txt) are updated to reflect the new transitive dependency setup—users now only need to link against Metall::Metall and do not need to manually specify Boost or Threads. [1] [2] [3] [4]

Internal Variables and Export Logic:

  • Internal variables are introduced to track Boost include directories, link items, and build dependencies, ensuring correct export and build order for both libraries and executables. [1] [2]

These changes make Metall much easier to integrate into user projects and ensure that all required dependencies are handled correctly and automatically, both when building from source and when using installed packages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant