optimisation: set gcc-{ar,nm,ranlib} for LTO targets
This commit is contained in:
parent
cec999bfdf
commit
e1ac923f32
@ -19,9 +19,9 @@ option(LTO "enable link-time optimisation" OFF)
|
||||
##-----------------------------------------------------------------------------
|
||||
## Enable link-time optimisation.
|
||||
##
|
||||
## Rather than rely on the INTERPROCEDURAL_OPTIMISATION flag we add some
|
||||
## arguments explicitly because we want a little more control over object
|
||||
## creation.
|
||||
## The INTERPROCEDURAL_OPTIMISATION flag is silently ignored for almost all
|
||||
## compilers. Fuck you too CMake. We have to make up for its deficiencies
|
||||
## ourselves.
|
||||
if (LTO)
|
||||
# Add the linker flags first otherwise the linker may not recognise the
|
||||
# object format
|
||||
@ -37,6 +37,15 @@ if (LTO)
|
||||
# particularly care about checking Debug/Release here because LTO is
|
||||
# pretty heavyweight anyway.
|
||||
append_compile_flag("-fdevirtualize-at-ltrans")
|
||||
|
||||
# If we're using GCC we probably need to use gcc-{ar,nm,ranlib} so that
|
||||
# plugin support works. Ideally we'd actually do some compilation tests,
|
||||
# but... it's a royal PITA with CMake.
|
||||
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||
set (CMAKE_AR "gcc-ar")
|
||||
set (CMAKE_NM "gcc-nm")
|
||||
set (CMAKE_RANLIB "gcc-ranlib")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user