Skip to content

Normalize paths when checking for implicit include dirs

Daniel Scharrer requested to merge dscharrer/cmake:master into master

GCC replaces implicit include directories with user-supplied ones if they point to the same directory, even if the path strings differ.

GCC compiled with Gentoo Crossdev for i686-w64-mingw32 is configured to look for system headers in /usr/i686-w64-mingw32/mingw/include. However, the mingw directory is just a symlink to usr installed by the w64-mingw32 package (https://bugs.gentoo.org/419601).

When listing the include directories in the -v output, GCC will print the /usr/i686-w64-mingw32/mingw/include without resolving symlinks, which results in CMake's CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES containing /usr/i686-w64-mingw32/mingw/include but not /usr/i686-w64-mingw32/usr/include. However when passed an -isystem /usr/i686-w64-mingw32/usr/include GCC will recognize that the two directories are the same and replace the implicit include directory. This changes the search order which leads to issue #16291 (closed).

Topic-rename: implicit-includes-realpath

Edited by Brad King

Merge request reports