Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions cmake/adjust_global_compile_flags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,21 @@ if (onnxruntime_ENABLE_LTO)
include(CheckIPOSupported)
check_ipo_supported(RESULT ipo_enabled OUTPUT ipo_output)
if (NOT ipo_enabled)
message(WARNING "IPO is not supported by this compiler")
message(WARNING "Interprocedural optimization (IPO) is not supported by this compiler. ${ipo_output}")
set(onnxruntime_ENABLE_LTO OFF)
else()
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ON)

# See https://cmake.org/cmake/help/latest/policy/CMP0069.html.
#
# "The OLD behavior for this policy is to add IPO flags only for Intel compiler on Linux.
# The NEW behavior for this policy is to add IPO flags for the current compiler or produce an error if CMake does
# not know the flags."
#
# CMake versions 3.8 and lower use the OLD behavior. This project requires CMake version > 3.8.
# However, some dependencies may specify a lower required CMake version and default to the OLD behavior.
# Ensure that CMake also uses the NEW behavior for such dependencies.
set(CMAKE_POLICY_DEFAULT_CMP0069 NEW)
endif()
endif()

Expand Down Expand Up @@ -342,4 +353,4 @@ endif()

if (onnxruntime_USE_EXTENSIONS)
include_directories(${REPO_ROOT}/include/onnxruntime/core/session)
endif()
endif()
Loading