[CMake] INTERPROCEDURAL_OPTIMIZATION still not using CMAKE_<LANG>_COMPILER_AR

lectem at gmail.com lectem at gmail.com
Sat Jul 22 07:33:01 EDT 2017


Hello guys,

So I downloaded the 3.9 release and thought my LTO nightmares were over but… cmake still isn’t using 
CMAKE_<LANG>_COMPILER_AR when linking on MSYS.

I’m using the « MSYS Makefiles » generator, and when building an executable it still uses the plain ar instead of gcc-ar…

CMAKE_CXX_COMPILER_AR is correctly set to C:/msys64/mingw64/bin/gcc-ar.exe but won’t use it…
I also tried to set CMAKE_AR to C:/msys64/mingw64/bin/gcc-ar.exe from cmake-gui but it’s not taken into account
Here’s the output :

[100%] Linking CXX executable BoilerPlate.exe
"/C/Program Files/CMake/bin/cmake.exe" -E remove -f CMakeFiles/BoilerPlate.dir/objects.a
/C/msys64/mingw64/bin/ar.exe cr CMakeFiles/BoilerPlate.dir/objects.a @CMakeFiles/BoilerPlate.dir/objects1.rsp
C:\msys64\mingw64\bin\ar.exe: CMakeFiles/BoilerPlate.dir/source/main.cpp.obj: plugin needed to handle lto object
/C/msys64/mingw64/bin/g++.exe -flto -fno-fat-lto-objects   -Wl,--whole-archive CMakeFiles/BoilerPlate.dir/objects.a -Wl,--no-whole-archive  -o BoilerPlate.exe -Wl,--out-implib,libBoilerPlate.dll.a -Wl,--major-image-version,0,--minor-image-version,0 @CMakeFiles/BoilerPlate.dir/linklibs.rsp

I’m not sure if it is a Windows/MSYS related problem (I think it is), but I really don’t understand why CMAKE wants to use C:/msys64/mingw64/bin/ar.exe so much and not the one in CMAKE_AR / CMAKE_CXX_COMPILER_AR…

If you guys have any idea.

Thanks,
Lectem
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20170722/cc6e5372/attachment-0001.html>


More information about the CMake mailing list