Skip to content

fix: boost's include dir was listed first #2384

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

Merged
merged 1 commit into from
Aug 12, 2020

Conversation

henryiii
Copy link
Collaborator

@henryiii henryiii commented Aug 12, 2020

Closes #2381

Boost's include directory (which is usually in a system include directory, such as in Homebrew) was being listed before the dependent target include directory, since it was directly set on the target rather than via a dependent target, like pybind11's headers, which meant that pybind11 in /usr/local/include was beating out local pybind11 in the compile line. This fix will work in CMake 3.12+ (where system includes are always placed after local includes, even if set directly instead on on a target. To fix it for CMake < 3.12, we probably would have to make a quick IMPORTED INTERFACE target for Boost (not a bad idea, but this only affects pybind11's own tests and when pybind11 is also in the boost directory - so not worried about old CMake's there)).

The even more correct fix would be to use Boost's targets if they exist, and make the target if it does not.

Copy link
Collaborator

@bstaletic bstaletic left a comment

Choose a reason for hiding this comment

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

Since this only affects pybind11's tests, I think this approach is fine.

Copy link
Collaborator

@YannickJadoul YannickJadoul left a comment

Choose a reason for hiding this comment

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

Agreed with @bstaletic. Minor fix; merge whenever you're happy with it! :-)

@henryiii henryiii merged commit f7abac6 into pybind:master Aug 12, 2020
@henryiii henryiii deleted the fix/sysdir branch August 12, 2020 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Recent CMake changes prefer pybind11 installed in /usr/local/include to development files [macOS]
3 participants