How to override the CMAKE_INCLUDE_SYSTEM_FLAG_<LANG>

The current development version of CMake introduces the system header distinction for MSVC.

But due to our distributed build system limitation, unable to use the -external:I in the command line.

Adding -D CMAKE_INCLUDE_SYSTEM_FLAG_C="-I " and -D CMAKE_INCLUDE_SYSTEM_FLAG_CXX="-I " seems not working (always emits -external:I)

Are there ways to override?

Thanks for testing master so we can figure this out without rushing the RC cycle :slight_smile: .

Those variables are defined locally, so they’ll shadow the cache values. It’d probably be easier to just unset the variables after after the project() call to disable this right now.

@brad.king Thoughts on if/how this should be handled?

@objectx is this limitation a temporary problem due to the system needing an update, or some fundamental incompatibility?

Our distributed build system is SN-DBS. The compiler wrapper must recognize the -I for capturing related files, but -external:I seems not to be handled at this time.

I’ve already contacted the developer for this issue, but the fix is uncertain.

Since the flag is supported by MSVC, eventually the rest of the ecosystem should understand it. Therefore I’m hesitant to add an official suppression feature to CMake for it. However, one could look at the project() command’s code injection feature to inject code that runs after the project() command enables C and CXX, and then unsets the CMAKE_INCLUDE_SYSTEM_FLAG_{C,CXX} variables. These are not officially meant for public usage, but for a short-term workaround should be fine.

I’ve got the answer from the SN-DBS Developer.

We are currently preparing a patch to add support for “-external:I”

I’ll try the suggested workaround. Thanks!

And overriding via CMAKE_PROJECT_INCLUDE works as expected. :bowing_man: