I am cross compiling to ARM using the g++ 7.2 compilers provided with the
Xilinx SDK.

This compiler was built using old assumptions about system headers being
pure C, such
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'.

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.

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.

For example, the yaml-cpp <https://github.com/jbeder/yaml-cpp> project
declares its include directories like this:

if (NOT CMAKE_VERSION VERSION_LESS 2.8.12)
    target_include_directories(yaml-cpp
        PUBLIC $<BUILD_INTERFACE:${YAML_CPP_SOURCE_DIR}/include>
               $<INSTALL_INTERFACE:${INCLUDE_INSTALL_ROOT_DIR}>
        PRIVATE $<BUILD_INTERFACE:${YAML_CPP_SOURCE_DIR}/src>)
endif()

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.

Thanks,

Jim Lloyd
EtaGen Inc.
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake

Reply via email to