diff --git a/components/core/CMakeLists.txt b/components/core/CMakeLists.txt index f71f7056ea..7c2f408a02 100644 --- a/components/core/CMakeLists.txt +++ b/components/core/CMakeLists.txt @@ -21,6 +21,15 @@ if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE STRING "Choose the type of build." FORCE) endif() +if (CMAKE_BUILD_TYPE MATCHES "Release") + include(CheckIPOSupported) + check_ipo_supported(RESULT IPO_SUPPORTED OUTPUT) + if(IPO_SUPPORTED) + message(STATUS "Link-time optimization enabled.") + set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ON) + endif() +endif() + set(CMAKE_EXPORT_COMPILE_COMMANDS ON) # Set general compressor