<div dir="ltr">We are using a library that adds all of it's subdirectories to the include search path (hundreds of directories and thousands of files). This is done because they change their folder structure constantly (but we don't care as we are upgrading every once in a while and can adjust).<div>We don't want this for our usage as the file names are very generic and can cause name clashes (`Queue.h` for example) with other third party libs.</div><div><br></div><div>We want to rewrite their build system (which is not cmake originally, but that is a different story) so that this addition of include directories is private.</div><div><br></div><div>Namely simple write:</div><div><br></div><div>target_include_directories(Lib PRIVATE ${LIB_SUBDIRECTORIES})</div><div><br></div><div>Here is the problem and question:</div><div>When building the lib like this, everything works great, but when our project that depends on the library is built, there are preprocessor errors - we include files from the library which in turn include other lib files with non relative includes - and in our target build step the compiler does not have the include directories needed to resolve the non relative include.</div><div>Example:</div><div><br></div><div>Lib</div><div>    dirA</div><div>      file_a.h</div><div>    dirB</div><div>     file_b.h</div><div><br></div><div>//file_a.h</div><div>#include "file_b.h"</div><div><br></div><div>//main.cpp</div><div>#include "Lib\dirA\file_a.h"</div><div><br></div><div>App</div><div>    main.cpp</div><div><br></div><div>//CMake builds `Lib` okay.</div><div>//CMake fails to build `App` due to non-relative include in `file_a.h`</div><div><br></div><div><br></div><div>Is there a way to have it both ways? Build the library with all include paths, and in target depending on it - not add all of them?</div><div>Can precompiled headers do this?</div><div>Is there a pure cmake solution?</div></div>