mingw: CMake not suppressing implicit include directories
When setting CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES via a command line argument (e.g. -DCMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES:PATH=/usr/i686-w64-mingw32/include
) CMake previously did not add a -isystem
flag for those directories (e.g. here I would not get on the GCC invocation -isystem /usr/i686-w64-mingw32/include
).
That worked until updating to CMake 3.14.0 and works again after downgrading to CMake 3.13.4. So it seems like a change in CMake 3.14.0 causes the issue.
Explicitly specifying an implicit include directory via -isystem
leads to compile errors, e.g.:
[ 7%] Building CXX object connector/CMakeFiles/syncthingconnector_static.dir/syncthingconnection.cpp.obj
In file included from /usr/i686-w64-mingw32/include/c++/8.3.0/ext/string_conversions.h:41,
from /usr/i686-w64-mingw32/include/c++/8.3.0/bits/basic_string.h:6400,
from /usr/i686-w64-mingw32/include/c++/8.3.0/string:52,
from /usr/i686-w64-mingw32/include/c++/8.3.0/stdexcept:39,
from /usr/i686-w64-mingw32/include/c++/8.3.0/array:39,
from /usr/i686-w64-mingw32/include/c++/8.3.0/tuple:39,
from /usr/i686-w64-mingw32/include/c++/8.3.0/functional:54,
from /usr/i686-w64-mingw32/include/c++utilities/chrono/timespan.h:7,
from /usr/i686-w64-mingw32/include/c++utilities/chrono/datetime.h:4,
from /build/mingw-w64-syncthingtray-static/src/syncthingtray-0.9.0/connector/././syncthingdev.h:6,
from /build/mingw-w64-syncthingtray-static/src/syncthingtray-0.9.0/connector/./syncthingconnection.h:4,
from /build/mingw-w64-syncthingtray-static/src/syncthingtray-0.9.0/connector/syncthingconnection.cpp:1:
/usr/i686-w64-mingw32/include/c++/8.3.0/cstdlib:75:15: fatal error: stdlib.h: No such file or directory
#include_next <stdlib.h>
I have no "simple" project file to reproduce the issue yet. The script I'm using to invoke CMake can be found here: https://aur.archlinux.org/packages/mingw-w64-cmake
Likely most of the projects listed there under "Required by" are affected.