Skip to content
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

Include path pollution #125

Open
MetroWind opened this issue Sep 24, 2024 · 3 comments
Open

Include path pollution #125

MetroWind opened this issue Sep 24, 2024 · 3 comments

Comments

@MetroWind
Copy link

I’m building my project with cryptopp using FetchContent:

FetchContent_Declare(
  cryptopp_cmake
  GIT_REPOSITORY https://github.com/abdes/cryptopp-cmake.git
)
set(CRYPTOPP_BUILD_TESTING OFF)
FetchContent_MakeAvailable(cryptopp_cmake)

target_link_libraries(some_thing PRIVATE ... cryptopp::cryptopp ...)

This seems to add _deps/cryptopp_cmake-build/cryptopp to the include paths, which means if I #include <zlib.h> it includes the zlib.h from cryptopp, instead of the header from the actual zlib. (Actually I don’t use zlib.h but another dependency does, and it’s including the wrong header.) Is this the intended behavior?

@Vollstrecker
Copy link
Collaborator

Not surprising as the includes are not reachable otherwise. I can't check here atm. would it work if you remove this line?

@Vollstrecker
Copy link
Collaborator

Addendum: Or the one after that. I know I've added them, but I'm pretty sure source_dir plus the Prefix in your code should be enough.

@MetroWind
Copy link
Author

Not surprising as the includes are not reachable otherwise. I can't check here atm. would it work if you remove this line?

Yes! Removing this line worked for me.

MetroWind added a commit to MetroWind/planck-blog that referenced this issue Sep 24, 2024
Before this change, I was using the crypto++ package installed on the
system with pkg-config. However Ubuntu’s package doesn’t ship with a
.pc file. See
weidai11/cryptopp#133 (comment).
I’m not surprised at this point. Typical Ubuntu/Debian behavior. I
think they are part of the reason everybody is using Docker now. So
I’m using a Cmake setup to build from the git repo. The Cmake project
has a bug that conflicts with
zlib.h (abdes/cryptopp-cmake#125), so I have
to used a workaround.
MetroWind added a commit to MetroWind/planck-blog that referenced this issue Sep 30, 2024
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

No branches or pull requests

2 participants