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