Cannot add default GCC system include path when using -nostdinc
Through an INTERFACE target I'm trying to add one of the default/implicit system include paths as -isystem
include directory. However, CMake filters them out. I'm using -nostdinc
which removes all implicit system directories, which CMake doesn't understand. In particular, this broke for me with 3.14.0 as I used one of the non-hardcoded paths which CMake now detects dynamically, see !2716 (merged). Also see #16291 (closed).
I need to use an INTERFACE target and I need to use -nostdinc
. This leaves me in a place where I cannot update CMake.
Suggestion: Extend the include path removal logic by first checking whether -nostdinc
appears as compiler flag for a target, and in that case don't automatically remove directories. If that's too hard/brittle, then maybe a new target property that can be set to disable this behavior would do it as well.