Skip to content

feat(c++): Improve CMakeLists.txt for portable library distribution and installation #810

Open

Description

@yangxk1

Describe the enhancement requested

rel: #806
The current CMakeLists.txt in GraphAr does not fully support robust distribution and installation of the library. This issue proposes a comprehensive update to:

  • Generate install targets for library components and headers
  • Export CMake config files for find_package support in downstream projects
  • Ensure headers, artifacts, and dependencies are correctly installed
  • Facilitate use in various build systems and package managers

These enhancements will improve the adoption and packaging of GraphAr for both users and external contributors.

Component(s)

C++

Activity

  1. tanmoyPaul12 commented on Dec 28, 2025

    @tanmoyPaul12

    Hi! I’m interested in working on this issue

    Planned approach:

    Add proper CMake install() rules for libraries and public headers
    Export targets and generate CMake config files to support find_package(GraphAr)
    Validate installation and usage from a minimal downstream project

    Please let me know if this works for you. Thanks!

  2. yangxk1 commented on Dec 29, 2025

    @yangxk1
    ContributorAuthor

    Hi @tanmoyPaul12 , thanks for claiming this!
    While working on the CMake configuration, could you please consider the following linking strategy to ensure the distribution is robust?

    1. Hybrid Linking:
    • Dependencies built from source (bundled) should ideally be statically linked (e.g., by forcing BUILD_SHARED_LIBS=OFF for those targets). This keeps the installation self-contained.
    • System dependencies can remain dynamic (or whatever the system provides).
    1. RPATH Configuration:
    • For dynamic linking, please ensure CMAKE_INSTALL_RPATH is correctly set (e.g., using $ORIGIN on Linux) so that users don't need to manually configure LD_LIBRARY_PATH to run the installed library.

    The following is the ideal rendering proposed by @Sober7135

    Image

    I also wrote a draft, hope it helps. https://github.com/yangxk1/incubator-graphar/blob/810-improve-cmakelist-library-distribution/cpp/CMakeLists.txt

    cc @Sober7135

  3. tanmoyPaul12 commented on Dec 29, 2025

    @tanmoyPaul12

    @yangxk1 Thanks for the detailed guidance and the draft. I’ll follow the hybrid linking approach you suggested and make sure the RPATH is set correctly

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions