I have an executable and a dynamic library that both depend on a static libary. If more context helps, the executable embeds a Python interperter and the dynamic library is a Python extension module. The dynamic library should not link to the static library because the later is already linked by the executable. However, the dynamic library requires headers from the static library to compile, which is only supplied implicitly via target_link_libraries. In effect, What I need is a target_link_libraries that adds include paths and does nothing else.
Here is what I've tried:
Retrieve include directories from target property of the static library, but indirectly included headers are still missing.
Have the executable and the dynamic library both link to the static library. That can't be expected to work, and it doesn't.
Turn the static library into a dynamic library. That would work, but I would like to avoid touching build scripts for the static library and the executable as much as possible.
Make the dynamic library static and links it with executable. This is impossible because Python extensions must be dynamically loaded.
Usually find_package(Foo) defines packages' include directories in a variable FOO_INCLUDE_DIR.
You can simply add that to your project's include path with
include_directories("${FOO_INCLUDE_DIR}")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With