Skip to content

Do not exclude include directories made implicit by CPATH

Brad King requested to merge brad.king/cmake:implicit-includes-CPATH into master

Entries of the CPATH environment variable are implicitly searched as include directories by some C/C++ compilers. Since !2716 (merged) these entries are detected by CMake and included in the CMAKE_{C,CXX}_IMPLICIT_INCLUDE_DIRECTORIES variables.

However, we should not exclude them from explicit specification via -I or particularly -isystem because they are meant as user-specified include directories that can be re-ordered without breaking compiler builtin headers. In particular, we need explicit requests via include_directories with the SYSTEM option to result in -isystem so that third-party headers do not produce warnings.

Fixes: #19291 (closed)

Merge request reports