mirror of https://github.com/procxx/kepka.git
Allow user to enable or disable interpocedural optimizations.
IPO optimizations will be disabled by default. To enable you need to forward cmake build flag -DENABLE_IPO:BOOL=ON. Signed-off-by: Vitaly Zaitsev <vitaly@easycoding.org>
This commit is contained in:
parent
9fc007889b
commit
f792920622
|
@ -95,6 +95,7 @@ if (CCACHE)
|
|||
set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE})
|
||||
endif()
|
||||
|
||||
option(ENABLE_IPO "Enable IPO optimizations." OFF)
|
||||
|
||||
option(BUILD_DOC "Build documentation" OFF)
|
||||
mark_as_advanced(BUILD_DOC)
|
||||
|
|
|
@ -696,19 +696,21 @@ if (LINUX)
|
|||
endif()
|
||||
|
||||
# Enable LTO optimizations...
|
||||
include(CheckIPOSupported)
|
||||
check_ipo_supported(RESULT ipo_result OUTPUT ipo_output)
|
||||
if(ENABLE_IPO)
|
||||
include(CheckIPOSupported)
|
||||
check_ipo_supported(RESULT ipo_result OUTPUT ipo_output)
|
||||
|
||||
if(ipo_result)
|
||||
message(STATUS "IPO optimizations enabled.")
|
||||
if(LINUX AND (CMAKE_CXX_COMPILER_ID MATCHES "GNU"))
|
||||
set(CMAKE_AR "/usr/bin/gcc-ar")
|
||||
set(CMAKE_RANLIB "/usr/bin/gcc-ranlib")
|
||||
set(CMAKE_NM "/usr/bin/gcc-nm")
|
||||
if(ipo_result)
|
||||
message(STATUS "IPO optimizations enabled.")
|
||||
if(LINUX AND (CMAKE_CXX_COMPILER_ID MATCHES "GNU"))
|
||||
set(CMAKE_AR "/usr/bin/gcc-ar")
|
||||
set(CMAKE_RANLIB "/usr/bin/gcc-ranlib")
|
||||
set(CMAKE_NM "/usr/bin/gcc-nm")
|
||||
endif()
|
||||
set_property(TARGET Kepka PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
|
||||
else()
|
||||
message(WARNING "IPO is not supported: ${ipo_output}")
|
||||
endif()
|
||||
set_property(TARGET Kepka PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
|
||||
else()
|
||||
message(WARNING "IPO is not supported: ${ipo_output}")
|
||||
endif()
|
||||
|
||||
##================================================
|
||||
|
|
Loading…
Reference in New Issue