Repository navigation
Conversation
…ROOTDIR Fixes item 7 of pybind#6159.
0113298 to
840951e
Compare
|
— codex on behalf of Ralf — Compute the prefix from the actual pkg-config install path. I configured and installed this head with CMake 3.28 and Generated by Codex. Ralf has yet to review these findings. |
Values such as "." or "./share" gave one ".." too many. Compute the relative path from the normalized pkgconfig install directory instead. Assisted-by: ClaudeCode:claude-fable-5-2
|
🤖 AI text below 🤖 Confirmed. With Fixed in f4adf6c:
I ran the test locally with CMake 3.25 and 4.5 only. |
🤖 AI text below 🤖
The
cmake_path(RELATIVE_PATH ...)branch gave the base directory as the literal stringCMAKE_INSTALL_DATAROOTDIRinstead of its value, so on CMake 3.20 and later the installedpybind11.pchad an emptyprefix=. Also, the.pcfile needs a path relative to${pcfiledir}, not relative to the data root.The
cmake_pathbranch and thewhile()loop are both removed. The prefix is now the relative path from the normalized pkg-config install directory to the install prefix. It usesget_filename_component(... ABSOLUTE BASE_DIR ...)andfile(RELATIVE_PATH ...), which work in CMake 3.15. This also fixesCMAKE_INSTALL_DATAROOTDIRvalues such as.and./share, which the loop got wrong:CMAKE_INSTALL_DATAROOTDIRprefix=.${pcfiledir}/..share,share/,./share${pcfiledir}/../..lib/foo/share${pcfiledir}/../../../..A new
test_build_pkgconfig_prefixtarget (part oftest_cmake_build) installs with each of these values and checks thatprefix=resolves to the install prefix.The CMP0190 fix is now in a separate PR.
Suggested changelog entry:
prefix=value in the installedpybind11.pc, which was empty with CMake 3.20 and later, and wrong for someCMAKE_INSTALL_DATAROOTDIRvalues such as..