_DETERMINE_GCC_SYSTEM_INCLUDE_DIRS should respect CMAKE_SYSROOT, etc specified in CMAKE_TOOLCHAIN_FILE
_DETERMINE_GCC_SYSTEM_INCLUDE_DIRS
(defined in CMake/Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake
) is used to populate the
CMAKE_EXTRA_GENERATOR_C{XX}_SYSTEM_DEFINED_MACROS
and CMAKE_EXTRA_GENERATOR_C{XX}_SYSTEM_INCLUDE_DIRS
cache entries which are used by IDE's such as EclipseCDT, CodeBlocks, and (maybe) Clion.
This is achieved by invoking the compiler /w -v -E -x c -dD dummy
and some other decoration (such as the c++ standard lib). However, it currently does not pass proper --sysroot=
and --target=
that are specified by -DCMAKE_TOOLCHAIN_FILE
leading to incorrect values in the cache entries, and IDE confusion.
- NOTE: This is mostly problematic for cross compiling w/
clang
, as in the typical use case forgcc
of having onegcc
built per sysroot/target architecture combo, the naked-v -E -x c -dD dummy
invocation ends up producing the correct information. - NOTE: On darwin, this should also respect
CMAKE_OSX_SYSROOT
(also likely to be defined in a tool chain file).
cheers, nehal
Edited by Nehal Patel