Skip to content

fix(build): make package config relocatable#306

Open
zjw1111 wants to merge 6 commits into
alibaba:mainfrom
zjw1111:codex/fix-paimon-package-config
Open

fix(build): make package config relocatable#306
zjw1111 wants to merge 6 commits into
alibaba:mainfrom
zjw1111:codex/fix-paimon-package-config

Conversation

@zjw1111
Copy link
Copy Markdown
Collaborator

@zjw1111 zjw1111 commented May 26, 2026

Purpose

Linked issue: none

Fix the generated CMake package config so downstream find_package(Paimon) uses
relocatable installed targets instead of hard-coded install-time library paths.

The previous PaimonConfig.cmake.in manually declared static/shared imported
targets with @CMAKE_INSTALL_PREFIX@, @CMAKE_INSTALL_LIBDIR@, and
Linux-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 installed
PaimonTargets.cmake export set. The exported target set is populated only by
the 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_shared and
Paimon::paimon_shared, instead of relying on global include directories or
unqualified target names.

Finally, it hardens ci/scripts/build_paimon.sh by quoting path expansions and
using mkdir -p for the build directory.

Tests

  • git diff --cached --check
  • git diff --check
  • git diff --check HEAD~1..HEAD
  • bash -n ci/scripts/build_paimon.sh
  • cmake-format --check CMakeLists.txt cmake_modules/BuildUtils.cmake PaimonConfig.cmake.in
  • cmake-format --check examples/CMakeLists.txt
  • cmake -S . -B /tmp/paimon-cpp-package-config-check -DPAIMON_BUILD_TESTS=OFF

API and Format

No public API or storage format changes.

Documentation

Updates docs/source/build_system.rst to use exported CMake package targets.

Generative AI tooling

Generated-by: OpenAI Codex

@zjw1111 zjw1111 marked this pull request as ready for review May 26, 2026 13:58
Copilot AI review requested due to automatic review settings May 26, 2026 13:58
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.in to rely on @PACKAGE_INIT@ + PaimonTargets.cmake instead of manually declaring imported targets with install-time absolute paths.
  • Install an export set (PaimonTargets) populated by add_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.

Comment thread PaimonConfig.cmake.in
Comment thread CMakeLists.txt
@zjw1111 zjw1111 requested a review from Copilot May 27, 2026 12:11
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.

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.

2 participants