Skip to content

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

Open
shivendra-dev54 wants to merge 1 commit intoapache:mainfrom
shivendra-dev54:810-improve-cmakelists
Open

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

Conversation

@shivendra-dev54
Copy link
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

codecov-commenter commented Feb 28, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.86%. Comparing base (d535a43) to head (28d3f6f).

Additional details and impacted files
@@             Coverage Diff              @@
##               main     #890      +/-   ##
============================================
+ Coverage     79.81%   79.86%   +0.04%     
  Complexity      615      615              
============================================
  Files            93       93              
  Lines         10296    10296              
  Branches       1055     1055              
============================================
+ Hits           8218     8223       +5     
+ Misses         1838     1833       -5     
  Partials        240      240              
Flag Coverage Δ
cpp 70.89% <ø> (+0.09%) ⬆️

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
Contributor Author

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

@yangxk1
Copy link
Contributor

yangxk1 commented Mar 2, 2026

cc @Sober7135

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