Skip to content

DetermineCompiler: Restore identification of MSVC with no INCLUDE dirs

Brad King requested to merge brad.king/cmake:compiler-id-msvc-has-include into master

Since !6121 (merged), our generated compiler id source file contains a preprocessor condition of the form

#elif ... && __has_include(...)

When MSVC is invoked with no include directories in the INCLUDE environment variable or in -I flags, its implementation of __has_include errors out immediately. This breaks identification of the compiler.

Work around the problem by adding a fallback attempt to compile the identification source using a dummy include directory.

See discussion on discourse.

Backport: release

Edited by Brad King

Merge request reports