Skip to content

Commit c3f4c2b

Browse files
build(core): Enable link-time optimization for improved runtime performance. (#1104)
Co-authored-by: kirkrodrigues <[email protected]>
1 parent 0bfaf5c commit c3f4c2b

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

components/core/CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,15 @@ if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
2121
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE STRING "Choose the type of build." FORCE)
2222
endif()
2323

24+
if (CMAKE_BUILD_TYPE MATCHES "Release")
25+
include(CheckIPOSupported)
26+
check_ipo_supported(RESULT IPO_SUPPORTED OUTPUT)
27+
if(IPO_SUPPORTED)
28+
message(STATUS "Link-time optimization enabled.")
29+
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ON)
30+
endif()
31+
endif()
32+
2433
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
2534

2635
# Set general compressor

0 commit comments

Comments
 (0)