MinGW/MSYS Makefiles ignoring INTERPROCEDURAL_OPTIMIZATION
INTERPROCEDURAL_OPTIMIZATION
doesn't work on windows with GCC (at least with the generators mentioned before) because of Windows-GNU.cmake as it ignores CMAKE_<LANG>_COMPILER_AR
.
The problem is that this code: https://gitlab.kitware.com/cmake/cmake/blob/v3.9.0/Modules/Platform/Windows-GNU.cmake#L117-127
inserts use of the archiver into the main linking process as a way to work around Windows command-line length limits. Since it is using the archiver as part of linking instead of just for creating a static library, our logic to switch to
CMAKE_<LANG>_COMPILER_AR
for LTO is not triggering
Edited by Ben Boeckel