<div dir="ltr"><div>I am cross compiling to ARM using the g++ 7.2 compilers provided with the Xilinx SDK.</div><div><br></div><div>This compiler was built using old assumptions about system headers being pure C, such</div><div>that when compiled from a .cpp source, the header is wrapped in an `extern "C" {}`. This causes true C++ headers to fail when compiling templates, with 'error: template with C linkage'.</div><div><br></div><div>I have filed a bug against the ARM gcc compiler, but I would like to be able to workaround the bug with CMake if possible. And as I read the documentation, I am beginning to think that there may be a bug in CMake too.</div><div><br></div><div>As I read the documentation for target_include_directories, the `-isystem` option for specifying an include directory is triggered by the SYSTEM option, and therefore should not be used when SYSTEM is not specified. But it seems to me that `-isystem` may be used even if SYSTEM is not specified.</div><div><br></div><div>For example, the <a href="https://github.com/jbeder/yaml-cpp">yaml-cpp</a> project declares its include directories like this:</div><div><br></div><div><font face="monospace, monospace">if (NOT CMAKE_VERSION VERSION_LESS 2.8.12)</font></div><div><font face="monospace, monospace">    target_include_directories(yaml-cpp</font></div><div><font face="monospace, monospace">        PUBLIC $<BUILD_INTERFACE:${YAML_CPP_SOURCE_DIR}/include></font></div><div><font face="monospace, monospace">               $<INSTALL_INTERFACE:${INCLUDE_INSTALL_ROOT_DIR}></font></div><div><font face="monospace, monospace">        PRIVATE $<BUILD_INTERFACE:${YAML_CPP_SOURCE_DIR}/src>)</font></div><div><font face="monospace, monospace">endif()</font></div><div><br></div><div>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.</div><div><br></div><div>Is this a bug in CMake? </div><div><br></div><div>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.</div><div><br></div><div>Thanks,</div><div><br></div><div>Jim Lloyd</div><div>EtaGen Inc.</div><div><br></div></div>