From e22be59f82caf3bdad0d083a6b25bd983c600171 Mon Sep 17 00:00:00 2001 From: Tillmann Karras Date: Sat, 3 May 2014 11:54:31 +0200 Subject: [PATCH] Fix LTO with GCC 4.9 For LTO to work, GCC 4.9 requires using the wrappers gcc-ar and gcc-ranlibs: http://gcc.gnu.org/gcc-4.9/changes.html CMake doesn't account for this yet: http://public.kitware.com/pipermail/cmake-developers/2014-January/009344.html --- CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index f1f5f42adc..22cd38286c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -209,6 +209,10 @@ endif() if(ENABLE_LTO) check_and_add_flag(LTO -flto) + if(CMAKE_CXX_COMPILER_ID STREQUAL GNU) + set(CMAKE_AR gcc-ar) + set(CMAKE_RANLIB gcc-ranlib) + endif() endif() if(APPLE)