[cmake,lto] only check again if not detected

This commit is contained in:
Armin Novak 2023-12-22 14:26:40 +01:00 committed by akallabeth
parent a7decba8c2
commit 0aa084d261

View File

@ -5,15 +5,18 @@ option(WITH_LIBRARY_VERSIONING "Use library version triplet" ON)
option(WITH_BINARY_VERSIONING "Use binary versioning" OFF) option(WITH_BINARY_VERSIONING "Use binary versioning" OFF)
option(BUILD_SHARED_LIBS "Build shared libraries" ON) option(BUILD_SHARED_LIBS "Build shared libraries" ON)
# TODO: The detection does not properly work # known issue on android, thus disabled until we support newer CMake
# # https://github.com/android/ndk/issues/1444
#include(CheckIPOSupported) if (NOT ANDROID)
#check_ipo_supported(RESULT supported OUTPUT error) cmake_policy(SET CMP0069 NEW)
#if (NOT supported) include(CheckIPOSupported)
# message(WARNING "LTO not supported, got ${error}") check_ipo_supported(RESULT supported OUTPUT error)
#endif() if (NOT supported)
message(WARNING "LTO not supported, got ${error}")
endif()
option(CMAKE_INTERPROCEDURAL_OPTIMIZATION "build with link time optimization" OFF) option(CMAKE_INTERPROCEDURAL_OPTIMIZATION "build with link time optimization" ${supported})
endif()
# Default to release build type # Default to release build type
if(NOT CMAKE_BUILD_TYPE) if(NOT CMAKE_BUILD_TYPE)