Skip to content

Commit fd995f3

Browse files
committed
Enable interprocedural optimization
1 parent 69e01f3 commit fd995f3

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

CMakeLists.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,19 @@ if(ENABLE_WARNINGS)
108108
endif()
109109
endif()
110110

111+
option(ENABLE_LTO "Enable interprocedural optimization for Release builds." ON)
112+
if(ENABLE_LTO)
113+
include(CheckIPOSupported)
114+
check_ipo_supported(RESULT H3_IPO_SUPPORTED
115+
OUTPUT H3_IPO_CHECK_OUTPUT
116+
LANGUAGES C)
117+
if(H3_IPO_SUPPORTED)
118+
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE ON)
119+
else()
120+
message(STATUS "IPO/LTO is not supported: ${H3_IPO_CHECK_OUTPUT}")
121+
endif()
122+
endif()
123+
111124
if(NOT MSVC)
112125
# Compiler options are set only on non-Windows, since these options are not
113126
# correct for MSVC.

0 commit comments

Comments
 (0)