Check for IPO
This commit is contained in:
parent
a39b05fe42
commit
4d139137cc
2 changed files with 17 additions and 0 deletions
|
|
@ -18,6 +18,9 @@ option (SFIZZ_BENCHMARKS "Enable benchmarks build [default: OFF]" OFF)
|
||||||
option (SFIZZ_TESTS "Enable tests build [default: OFF]" OFF)
|
option (SFIZZ_TESTS "Enable tests build [default: OFF]" OFF)
|
||||||
option (SFIZZ_SHARED "Enable shared library build [default: ON]" ON)
|
option (SFIZZ_SHARED "Enable shared library build [default: ON]" ON)
|
||||||
|
|
||||||
|
# Don't use IPO in non Release builds
|
||||||
|
include (CheckIPO)
|
||||||
|
|
||||||
# Add Abseil
|
# Add Abseil
|
||||||
add_subdirectory (external/abseil-cpp EXCLUDE_FROM_ALL)
|
add_subdirectory (external/abseil-cpp EXCLUDE_FROM_ALL)
|
||||||
|
|
||||||
|
|
|
||||||
14
cmake/CheckIPO.cmake
Normal file
14
cmake/CheckIPO.cmake
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
# Added in CMake 3.9
|
||||||
|
include (CheckIPOSupported)
|
||||||
|
check_ipo_supported (RESULT result OUTPUT output)
|
||||||
|
|
||||||
|
if (result AND ENABLE_LTO AND ${CMAKE_BUILD_TYPE} MATCHES Release)
|
||||||
|
message (STATUS "\nLTO enabled.")
|
||||||
|
else()
|
||||||
|
if (${output})
|
||||||
|
message (WARNING "\nIPO disabled: ${output}")
|
||||||
|
else()
|
||||||
|
message (WARNING "\nIPO was disabled, not in a Release build?")
|
||||||
|
endif()
|
||||||
|
set (ENABLE_LTO OFF)
|
||||||
|
endif()
|
||||||
Loading…
Add table
Reference in a new issue