Hi,
I’m new to CMake. I’ve been listening to and watching lots of CMake talks, learning about “modern” cmake, etc. I understand that I should be thinking in terms of targets. Got it.
Maybe I’m misunderstanding something, but I’m having an issue with dependents not inheriting public include properties from their dependencies.
For instance, I have a project that builds a shared library (MyLib) and three test applications (AppA, *B, and *C). So I have something like this:
add_library(MyLib SHARED my_lib.c)
target_include_directories(MyLib PUBLIC "/something/something/path")
add_exectuable(AppA app_a.c)
target_link_libraries(AppA PUBLIC MyLib)
Should the include directories from MyLib marked PUBLIC
be automatically included when building AppA because of the target_link_libraries(AppA PUBLIC MyLib)
? If so, I’m not seeing that behavior. When I examine both INCLUDE_DIRECTORIES
and INTERFACE_INCLUDE_DIRECTORIES
for AppA
target, both properties are empty, even though there is a dependency established via the call to target_link_libraries