Merge pull request #1672 from np511/master

Fix LTO flags.
This commit is contained in:
Gregory Hainaut 2016-11-25 17:09:54 +01:00 committed by GitHub
commit aeef39a417
1 changed files with 8 additions and 2 deletions

View File

@ -332,13 +332,19 @@ elseif (USE_GCC)
endif()
if (USE_LTO)
message(WARNING "LTO has not been thoroughly tested. It should work fine, but a bug is not impossible.")
#gcc --print-file-name=liblto_plugin.so
#set(LTO_FLAGS "-fuse-linker-plugin -flto=4 --plugin=/usr/lib/gcc/x86_64-linux-gnu/4.9/liblto_plugin.so")
#set(LTO_FLAGS "-fuse-linker-plugin -fuse-ld=gold -flto=4 --plugin=/usr/lib/gcc/x86_64-linux-gnu/4.9/liblto_plugin.so")
set(LTO_FLAGS "-fuse-linker-plugin -fuse-ld=gold -flto=4")
set(LTO_FLAGS "-fuse-linker-plugin -flto=4")
#set(LINK_FLAGS "--plugin=/usr/lib/gcc/x86_64-linux-gnu/4.9/liblto_plugin.so")
set(USER_CMAKE_LD_FLAGS "--plugin /usr/lib/gcc/x86_64-linux-gnu/4.9/liblto_plugin.so")
set(DBG "") # not supported with LTO
message(STATUS "Using \"gcc-ar\" instead of \"ar\"")
set(CMAKE_AR /usr/bin/gcc-ar CACHE STRING "Archiver" FORCE)
message(STATUS "Using \"gcc-ranlib\" instead of \"ranlib\"")
set(CMAKE_RANLIB /usr/bin/gcc-ranlib CACHE STRING "ranlib" FORCE)
message(STATUS "Using \"gcc-nm\" instead of \"nm\"")
set(CMAKE_NM /usr/bin/gcc-nm CACHE STRING "nm" FORCE)
else()
set(LTO_FLAGS "")
endif()