<div dir="ltr">Hello,<div><br></div><div>Is there a way to get the effective include directories and compile definitions for a target, including those specified at the directory level and any INTERFACE_INCLUDE_DIRECTORIES and INTERFACE_COMPILE_DEFINITION on targets that are required via target_link_libraries?</div>
<div><br></div><div>Iterating recursively over LINK_LIBRARIES to find interface include/definition is the alternative, but I guess I'd need to handle non-target dependencies, as well as possible cyclic dependencies.</div>
<div><br></div><div>Ideas?</div><div><br></div><div>Example:</div><div><br></div><div><div>include_directories(/path/to/common)</div><div>add_definitions(-DCOMMON=1)</div><div><br></div><div>add_library(lib1 lib1.c)<br></div>
<div>target_include_directories(lib1 PUBLIC /path/to/lib1)</div><div>target_compile_definitions(lib1 PUBLIC -DLIB1=1)</div><div><br></div><div>add_library(lib2 lib2.c)</div><div>target_include_directories(lib2 PUBLIC /path/to/lib2)</div>
<div>target_compile_definitions(lib2 PUBLIC -DLIB2=1)</div><div><br></div><div>target_link_libraries(lib2 lib1)</div></div><div><br></div><div>How would I get all 3 include directories and definitions for lib2 into variables? The INCLUDE_DIRECTORIES property on the lib2 target only includes the common and lib2-specific include directory, while the COMPILE_DEFINITIONS property only includes the specific definition, not even the directory-level definition (COMMON).</div>
<div><br>I'm trying to generate PC-Lint configuration files and need the definitions and include directories. The wiki solution no longer works with interface include_directories and compile_definitions.</div><div><br>
</div><div>Lars</div></div>