From 119fb635769fe5e7ba6a7b39f46a8a448882bacf Mon Sep 17 00:00:00 2001 From: "Daniel J. Hofmann" Date: Wed, 16 Sep 2015 18:56:29 +0200 Subject: [PATCH] LTO is broken on GCC < 4.9.0, disable it. References: - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57038 - https://github.com/Project-OSRM/node-osrm/pull/112 --- CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index ec3811788..520bfb4f2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -155,6 +155,11 @@ if(CMAKE_BUILD_TYPE MATCHES Release) set(CMAKE_AR "/usr/bin/gcc-ar") set(CMAKE_RANLIB "/usr/bin/gcc-ranlib") endif() + + if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND "${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS "4.9.0") + message(STATUS "Disabling LTO on GCC < 4.9.0 since it is broken, see: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57038") + set(CMAKE_CXX_FLAGS "${OLD_CXX_FLAGS}") + endif() endif() endif()