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)
|
endif(NOT CMAKE_BUILD_TYPE)
|
||||||
|
|
||||||
# Enable LTO if we're in a release build and LTO is supported
|
# Enable LTO if we're in a release build and LTO is supported
|
||||||
include(CheckIPOSupported)
|
string(TOUPPER ${CMAKE_BUILD_TYPE} _CMAKE_BUILD_TYPE_UPPER)
|
||||||
check_ipo_supported(RESULT LTO_SUPPORTED OUTPUT error)
|
if (_CMAKE_BUILD_TYPE_UPPER STREQUAL "DEBUG")
|
||||||
if(LTO_SUPPORTED)
|
message(STATUS "LTO disabled because we're in a debug build")
|
||||||
string(TOUPPER ${CMAKE_BUILD_TYPE} _CMAKE_BUILD_TYPE_UPPER)
|
else()
|
||||||
if (_CMAKE_BUILD_TYPE_UPPER STREQUAL "DEBUG")
|
include(CheckIPOSupported)
|
||||||
message(STATUS "LTO disabled because we're in a debug build")
|
check_ipo_supported(RESULT LTO_SUPPORTED OUTPUT error)
|
||||||
else()
|
if(LTO_SUPPORTED)
|
||||||
message(STATUS "LTO enabled")
|
message(STATUS "LTO enabled")
|
||||||
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
|
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
|
||||||
|
else()
|
||||||
|
message(WARNING "LTO disabled because compiler does not support it.")
|
||||||
endif()
|
endif()
|
||||||
else()
|
|
||||||
message(WARNING "LTO disabled because compiler does not support it.")
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(USE_CLANG_TIDY)
|
if(USE_CLANG_TIDY)
|
||||||
|
|
Loading…
Reference in New Issue