abdes / cryptopp-cmake

A modern CMake build project for Crypto++ (https://github.com/weidai11/cryptopp).
BSD 3-Clause "New" or "Revised" License
117 stars 43 forks source link

Include path pollution #125

Open MetroWind opened 1 month ago

MetroWind commented 1 month ago

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 commented 1 month ago

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

Vollstrecker commented 1 month ago

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 commented 1 month ago

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.