Skip to content

Commit

Permalink
[cmake,lto] only check again if not detected
Browse files Browse the repository at this point in the history
  • Loading branch information
Armin Novak committed Dec 22, 2023
1 parent 6cfa8af commit 3b8be97
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions cmake/CommonConfigOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,18 @@ option(WITH_LIBRARY_VERSIONING "Use library version triplet" ON)
option(WITH_BINARY_VERSIONING "Use binary versioning" OFF)
option(BUILD_SHARED_LIBS "Build shared libraries" ON)

# TODO: The detection does not properly work
#
#include(CheckIPOSupported)
#check_ipo_supported(RESULT supported OUTPUT error)
#if (NOT supported)
# message(WARNING "LTO not supported, got ${error}")
#endif()
# known issue on android, thus disabled until we support newer CMake
# https://github.com/android/ndk/issues/1444
if (NOT ANDROID)
cmake_policy(SET CMP0069 NEW)
include(CheckIPOSupported)
check_ipo_supported(RESULT supported OUTPUT error)
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
if(NOT CMAKE_BUILD_TYPE)
Expand Down

0 comments on commit 3b8be97

Please sign in to comment.