diff --git a/CMakeLists.txt b/CMakeLists.txt index eaff48ee0160899b078579e0ac17c1a9cf5a6630..8e0480637b47a8ce06e495bd0013d0fdff999ef1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -65,6 +65,16 @@ find_package(KF5GrantleeTheme ${GRANTLEETHEME_LIB_VERSION} CONFIG REQUIRED) find_package(KF5Purpose ${KF5_MIN_VERSION} CONFIG REQUIRED) +option(USE_UNIFY_CMAKE_SUPPORT "Use UNIFY cmake support (speedup compile time)" FALSE) + +set(COMPILE_WITH_CMAKE_SUPPORT false) +if (USE_UNIFY_CMAKE_SUPPORT) + if(${CMAKE_VERSION} VERSION_LESS "3.16.0") + message(STATUS "CMAKE version is less than 3.16.0 . We can't use cmake unify build support") + else() + set(COMPILE_WITH_CMAKE_SUPPORT true) + endif() +endif() option(BUILD_DESIGNERPLUGIN "Build plugin for Qt Designer" ON) add_feature_info(DESIGNERPLUGIN ${BUILD_DESIGNERPLUGIN} "Build plugin for Qt Designer") diff --git a/src/pimcommon/CMakeLists.txt b/src/pimcommon/CMakeLists.txt index f1d9bc1b533e1c2a1716b7bb67213ed5e5b03b23..f7620af45715d91575261228e28d3d0b3922c48d 100644 --- a/src/pimcommon/CMakeLists.txt +++ b/src/pimcommon/CMakeLists.txt @@ -165,6 +165,9 @@ kconfig_add_kcfg_files(libpimcommon_SRCS ) add_library(KF5PimCommon ${libpimcommon_SRCS}) +if (COMPILE_WITH_CMAKE_SUPPORT) + set_target_properties(KF5PimCommon PROPERTIES UNITY_BUILD ON) +endif() generate_export_header(KF5PimCommon BASE_NAME pimcommon) add_library(KF5::PimCommon ALIAS KF5PimCommon) diff --git a/src/pimcommonakonadi/CMakeLists.txt b/src/pimcommonakonadi/CMakeLists.txt index b5078cafb27683bf1780e2155da2c3570de6aebf..dc31a40da9aaf4b559b95aeaf5dd83c7c8dfa676 100644 --- a/src/pimcommonakonadi/CMakeLists.txt +++ b/src/pimcommonakonadi/CMakeLists.txt @@ -140,6 +140,10 @@ ecm_qt_declare_logging_category(libpimcommonakonadi_SRCS HEADER pimcommonakonadi add_library(KF5PimCommonAkonadi ${libpimcommonakonadi_SRCS}) +if (COMPILE_WITH_CMAKE_SUPPORT) + set_target_properties(KF5PimCommonAkonadi PROPERTIES UNITY_BUILD ON) +endif() + generate_export_header(KF5PimCommonAkonadi BASE_NAME pimcommonakonadi) add_library(KF5::PimCommonAkonadi ALIAS KF5PimCommonAkonadi)