From c8626dff3fedd86cf697e49aec00c9e17c9015d8 Mon Sep 17 00:00:00 2001 From: Zachary Michaels Date: Wed, 11 Jun 2014 13:13:43 -0400 Subject: [PATCH] Gcc 4.9 LTO fix The new lto format requires use of the gcc-provided gcc-ar and gcc-ranlib binaries. --- CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 28130e566..8b1e61a51 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -44,6 +44,11 @@ else() else() set(WARNINGS "${WARNINGS} -Wlogical-op -Wno-error=maybe-uninitialized") endif() + # Since gcc 4.9 the LTO format is non-standard (slim), so we need the gcc-specific ar and ranlib binaries + if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9.0)) + set(CMAKE_AR "gcc-ar") + set(CMAKE_RANLIB "gcc-ranlib") + endif() if(MINGW) set(WARNINGS "${WARNINGS} -Wno-error=unused-value") set(MINGW_FLAG "-DWIN32_LEAN_AND_MEAN")