-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(cmake): pybind11.pc: use pcfiledir for relative destinations #4830
Conversation
If the datarootdir is absolute, just use the absolute path directly. However, if it is relative, we can compute the prefix from the location of the `.pc` file itself. This allows the install to be relocatable.
9615bf6
to
ee95993
Compare
I keep forgetting, @eli-schwartz, does this change sound fine? |
Does that generally happen outside of a python wheel build? Because this currently manually sets the pcfiledir bits there from setup.py:
The broader issue here is that if the prefix is not absolute, then setting it as There's a couple issues I see with the current approach:
I wasn't generally sure of the answer to these types of questions, which is why I'd originally designed this to be absolute by default, and relocatable if you explicitly told cmake what string to relocate with. EDIT: this seems like it is implementing a polyfill? I'm probably just bad at reading cmake scripts, my apologies. |
The problem is if
I was trying to keep it as compatible as possible. If erroring on an absolute
The |
If the datarootdir is absolute, just use the absolute path directly. However, if it is relative, we can compute the prefix from the location of the
.pc
file itself. This allows the install to be relocatable.Description
pkgconf
has odd behaviors around absoluteprefix=
settings. Using this makes things work there.Suggested changelog entry:
``pybind11.pc`` is now relocatable by default as long as install destinations are not absolute paths