cryptopp-cmake icon indicating copy to clipboard operation
cryptopp-cmake copied to clipboard

Include path pollution

Open MetroWind opened this issue 1 year ago • 3 comments

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?

MetroWind avatar Sep 24 '24 18:09 MetroWind

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

Vollstrecker avatar Sep 24 '24 19:09 Vollstrecker

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.

Vollstrecker avatar Sep 24 '24 19:09 Vollstrecker

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 avatar Sep 24 '24 20:09 MetroWind