[CMake] target_include_directories and system headers

Jim Lloyd jim.lloyd at etagen.com
Thu Jun 28 14:20:01 EDT 2018


Thank you Nils, that is exactly the information I needed. Simply setting
`set(CMAKE_NO_SYSTEM_FROM_IMPORTED ON)` achieves the workaround I wanted.


On Wed, Jun 27, 2018 at 11:03 PM, Nils Gladitz <nilsgladitz at gmail.com>
wrote:

> On Thu, Jun 28, 2018 at 7:12 AM Jim Lloyd <jim.lloyd at etagen.com> wrote:
>
>> [...]
>> But if I make a trivial project that simply includes yaml-cpp as a
>> dependency, the generated compile commands use `-isystem` to include the
>> yaml-cpp headers.
>>
>> Is this a bug in CMake?
>>
>> Also, is there any way I may be able to work around this problem with
>> CMake 3.10? I would be happy to globally force the use of `-I` for all
>> include directories.
>>
>
> I think the question and a potential work around are covered by
> https://cmake.org/cmake/help/latest/manual/cmake-
> buildsystem.7.html#include-directories-and-usage-requirements
> Specifically the paragraph close to the end starting with "When the
> INTERFACE_INCLUDE_DIRECTORIES of an imported target...".
>
> Basically include directories inherited from imported targets are
> implicitly "SYSTEM" by default.
>
> Nils
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20180628/229f87ac/attachment.html>


More information about the CMake mailing list