Skip to content

feat(cpp): improve CMake configuration for portable distribution and installation (#810)#890

Closed
shivendra-dev54 wants to merge 2 commits intoapache:mainfrom
shivendra-dev54:810-improve-cmakelists
Closed

feat(cpp): improve CMake configuration for portable distribution and installation (#810)#890
shivendra-dev54 wants to merge 2 commits intoapache:mainfrom
shivendra-dev54:810-improve-cmakelists

Conversation

@shivendra-dev54
Copy link
Copy Markdown
Contributor

Reason for this PR

This PR addresses #810 to improve the portability and installation of the GraphAr C++ library. The current setup makes it difficult for downstream projects to use find_package(graphar), which this update resolves by modernizing the CMake export logic.

What changes are included in this PR?

  • Modern CMake Targets: Added support for the graphar::graphar namespace via install(EXPORT).
  • Hybrid Linking Strategy: Updated dependencies (Arrow/Parquet) to PUBLIC visibility to ensure proper propagation to consumers.
  • Relocatable Installation: - Integrated GNUInstallDirs for standard-compliant paths.
    • Set CMAKE_INSTALL_RPATH using $ORIGIN (Linux) and @loader_path (macOS) to ensure the library is relocatable.
  • Config File Modernization: Updated graphar-config.in.cmake using @PACKAGE_INIT@ and find_dependency for robust downstream resolution.
  • Backward Compatibility: Preserved the legacy GRAPHAR_LIBRARIES and GRAPHAR_INCLUDE_DIR variables.

Are these changes tested?

  • Verified that all 20 existing C++ unit tests pass (ctest).
  • Confirmed that make install generates a valid relocatable file structure.
  • Successfully linked a separate "Hello World" project using find_package(graphar REQUIRED).

Are there any user-facing changes?

Yes. Users can now integrate GraphAr into their own projects using the standard CMake pattern:

find_package(graphar REQUIRED)
target_link_libraries(my_app PRIVATE graphar::graphar)

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Feb 28, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.60%. Comparing base (b4bc86c) to head (bfde614).

Additional details and impacted files
@@            Coverage Diff            @@
##               main     #890   +/-   ##
=========================================
  Coverage     80.60%   80.60%           
  Complexity      615      615           
=========================================
  Files            94       94           
  Lines         10709    10709           
  Branches       1055     1055           
=========================================
  Hits           8632     8632           
  Misses         1837     1837           
  Partials        240      240           
Flag Coverage Δ
cpp 70.90% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@shivendra-dev54
Copy link
Copy Markdown
Contributor Author

@yangxk1
Could you please review and confirm whether this meets the requirements of the issue?

@yangxk1
Copy link
Copy Markdown
Contributor

yangxk1 commented Mar 2, 2026

cc @Sober7135

@shivendra-dev54 shivendra-dev54 force-pushed the 810-improve-cmakelists branch from 3cbe0f1 to 28d3f6f Compare March 10, 2026 07:29
Signed-off-by: devadhe sb <devadheshivendra54@gmail.com>
@shivendra-dev54 shivendra-dev54 deleted the 810-improve-cmakelists branch March 10, 2026 08:04
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.

3 participants