First check for debug build, then for LTO
This commit is contained in:
parent
b3c6658466
commit
1b0400fc54
|
@ -38,18 +38,18 @@ if(NOT CMAKE_BUILD_TYPE)
|
|||
endif(NOT CMAKE_BUILD_TYPE)
|
||||
|
||||
# Enable LTO if we're in a release build and LTO is supported
|
||||
include(CheckIPOSupported)
|
||||
check_ipo_supported(RESULT LTO_SUPPORTED OUTPUT error)
|
||||
if(LTO_SUPPORTED)
|
||||
string(TOUPPER ${CMAKE_BUILD_TYPE} _CMAKE_BUILD_TYPE_UPPER)
|
||||
if (_CMAKE_BUILD_TYPE_UPPER STREQUAL "DEBUG")
|
||||
message(STATUS "LTO disabled because we're in a debug build")
|
||||
else()
|
||||
string(TOUPPER ${CMAKE_BUILD_TYPE} _CMAKE_BUILD_TYPE_UPPER)
|
||||
if (_CMAKE_BUILD_TYPE_UPPER STREQUAL "DEBUG")
|
||||
message(STATUS "LTO disabled because we're in a debug build")
|
||||
else()
|
||||
include(CheckIPOSupported)
|
||||
check_ipo_supported(RESULT LTO_SUPPORTED OUTPUT error)
|
||||
if(LTO_SUPPORTED)
|
||||
message(STATUS "LTO enabled")
|
||||
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
|
||||
else()
|
||||
message(WARNING "LTO disabled because compiler does not support it.")
|
||||
endif()
|
||||
else()
|
||||
message(WARNING "LTO disabled because compiler does not support it.")
|
||||
endif()
|
||||
|
||||
if(USE_CLANG_TIDY)
|
||||
|
|
Loading…
Reference in New Issue