diff --git a/CMakeLists.txt b/CMakeLists.txt index 8d490ff73d3ff444e994ccd04fbc7000ce954113..c2c2369ce4622800f21d16d5019e4cfad4d4a9c6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,6 +4,7 @@ set(KF_VERSION "5.88.0") # handled by release scripts project(Sonnet VERSION ${KF_VERSION}) include(FeatureSummary) +include(CMakeDependentOption) find_package(ECM 5.87.0 NO_MODULE) set_package_properties(ECM PROPERTIES TYPE REQUIRED DESCRIPTION "Extra CMake Modules." URL "https://commits.kde.org/extra-cmake-modules") feature_summary(WHAT REQUIRED_PACKAGES_NOT_FOUND FATAL_ON_MISSING_REQUIRED_PACKAGES) @@ -63,11 +64,11 @@ if (BUILD_TESTING) add_subdirectory(autotests) endif() -if(TARGET Qt5::Widgets) +cmake_dependent_option(BUILD_EXAMPLES "Whether to build the examples" OFF "SONNET_USE_WIDGETS" OFF) +if (BUILD_EXAMPLES) add_subdirectory(examples) endif() - # create a Config.cmake and a ConfigVersion.cmake file and install them set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KF5Sonnet")