cmake: Use IPO only if supported

Signed-off-by: gatecat <gatecat@ds0.me>
This commit is contained in:
gatecat 2021-03-19 09:39:34 +00:00
parent aa8b12db6f
commit bac2a8ba02

View File

@ -7,7 +7,7 @@ cmake_policy(SET CMP0079 NEW)
# Enable IPO support. # Enable IPO support.
cmake_policy(SET CMP0069 NEW) cmake_policy(SET CMP0069 NEW)
include(CheckIPOSupported) include(CheckIPOSupported)
check_ipo_supported() check_ipo_supported(RESULT ipo_supported)
option(BUILD_GUI "Build GUI" OFF) option(BUILD_GUI "Build GUI" OFF)
option(BUILD_PYTHON "Build Python Integration" ON) option(BUILD_PYTHON "Build Python Integration" ON)
@ -19,8 +19,9 @@ option(STATIC_BUILD "Create static build" OFF)
option(EXTERNAL_CHIPDB "Create build with pre-built chipdb binaries" OFF) option(EXTERNAL_CHIPDB "Create build with pre-built chipdb binaries" OFF)
option(WERROR "pass -Werror to compiler (used for CI)" OFF) option(WERROR "pass -Werror to compiler (used for CI)" OFF)
option(PROFILER "Link against libprofiler" OFF) option(PROFILER "Link against libprofiler" OFF)
if(ipo_supported)
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE) set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
endif()
if(WIN32 OR EXTERNAL_CHIPDB) if(WIN32 OR EXTERNAL_CHIPDB)
set(BBASM_MODE "binary") set(BBASM_MODE "binary")