fix(build): make package config relocatable#306
Open
zjw1111 wants to merge 6 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the installed CMake package configuration for Paimon to be relocatable by switching from hard-coded @CMAKE_INSTALL_PREFIX@ imported library paths to a @PACKAGE_INIT@-based config that loads an installed PaimonTargets.cmake export set.
Changes:
- Simplify
PaimonConfig.cmake.into rely on@PACKAGE_INIT@+PaimonTargets.cmakeinstead of manually declaring imported targets with install-time absolute paths. - Install an export set (
PaimonTargets) populated byadd_paimon_lib()so only actually-installed targets are exported. - Consolidate CMake package install destinations via
${PAIMON_CMAKE_INSTALL_DIR}.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| PaimonConfig.cmake.in | Switch config to @PACKAGE_INIT@ and include the installed exported targets file. |
| CMakeLists.txt | Define/install the package config to a relocatable install dir and install the PaimonTargets export set. |
| cmake_modules/BuildUtils.cmake | Export installed *_shared/*_static targets into the unified PaimonTargets export set. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
Linked issue: none
Fix the generated CMake package config so downstream
find_package(Paimon)usesrelocatable installed targets instead of hard-coded install-time library paths.
The previous
PaimonConfig.cmake.inmanually declared static/shared importedtargets with
@CMAKE_INSTALL_PREFIX@,@CMAKE_INSTALL_LIBDIR@, andLinux-specific library filenames. This could expose targets for artifacts that
were not installed by the selected build options, and it could resolve to stale
paths after relocation.
This PR switches the package config to
@PACKAGE_INIT@and an installedPaimonTargets.cmakeexport set. The exported target set is populated only bythe targets actually installed through
add_paimon_lib().It also updates the examples CMake file and build-system documentation to link
against exported package targets such as
Arrow::arrow_sharedandPaimon::paimon_shared, instead of relying on global include directories orunqualified target names.
Finally, it hardens
ci/scripts/build_paimon.shby quoting path expansions andusing
mkdir -pfor the build directory.Tests
git diff --cached --checkgit diff --checkgit diff --check HEAD~1..HEADbash -n ci/scripts/build_paimon.shcmake-format --check CMakeLists.txt cmake_modules/BuildUtils.cmake PaimonConfig.cmake.incmake-format --check examples/CMakeLists.txtcmake -S . -B /tmp/paimon-cpp-package-config-check -DPAIMON_BUILD_TESTS=OFFAPI and Format
No public API or storage format changes.
Documentation
Updates
docs/source/build_system.rstto use exported CMake package targets.Generative AI tooling
Generated-by: OpenAI Codex