From 882c48acb971ea3bf7e69954056a779e823d932a Mon Sep 17 00:00:00 2001 From: Pcornat Date: Sat, 8 Mar 2025 13:38:47 +0100 Subject: [PATCH] Adding IPO support. --- CMakeLists.txt | 4 +++- src/CMakeLists.txt | 9 +++++++++ textengines/CMakeLists.txt | 6 ++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e4d89cf..608ac3b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,8 +1,10 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.18) project(qwt VERSION 6.1.3 LANGUAGES CXX) option(WITH_EXAMPLES "Whether to include examples" OFF) +include(CheckIPOSupported) + add_subdirectory(src) add_subdirectory(textengines) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c7339fe..d2d50cc 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -221,6 +221,8 @@ set(qwt_sources #---------------------------------------------------------------- # Target #---------------------------------------------------------------- +check_ipo_supported(RESULT result OUTPUT output) + if(QWT_USE_STATIC_LIBS) add_library(qwt STATIC ${qwt_headers} ${qwt_sources}) else() @@ -234,6 +236,13 @@ else() ) endif() +check_ipo_supported(RESULT result OUTPUT output) +if(result) + set_target_properties(qwt PROPERTIES INTERPROCEDURAL_OPTIMIZATION_RELEASE ON) +else() + message(WARNING "IPO is not supported: ${output}") +endif() + target_include_directories(qwt PUBLIC ${PROJECT_SOURCE_DIR}/include diff --git a/textengines/CMakeLists.txt b/textengines/CMakeLists.txt index e2d13dc..6dc4c7b 100644 --- a/textengines/CMakeLists.txt +++ b/textengines/CMakeLists.txt @@ -20,6 +20,12 @@ set(qwt_mathml_sources # Target #---------------------------------------------------------------- add_library(qwt_mathml SHARED ${qwt_mathml_headers} ${qwt_mathml_sources}) +check_ipo_supported(RESULT result OUTPUT output) +if(result) + set_target_properties(qwt_mathml PROPERTIES INTERPROCEDURAL_OPTIMIZATION_RELEASE ON) +else() + message(WARNING "IPO is not supported: ${output}") +endif() target_include_directories(qwt_mathml PUBLIC