Warning, /libraries/kopeninghours/CMakeLists.txt is written in an unsupported language. File is not indexed.

0001 # SPDX-FileCopyrightText: 2020 Volker Krause <vkrause@kde.org>
0002 # SPDX-License-Identifier: BSD-3-Clause
0003 
0004 cmake_minimum_required(VERSION 3.5)
0005 
0006 # KDE Application Version, managed by release script
0007 set (RELEASE_SERVICE_VERSION_MAJOR "23")
0008 set (RELEASE_SERVICE_VERSION_MINOR "08")
0009 set (RELEASE_SERVICE_VERSION_MICRO "1")
0010 set (RELEASE_SERVICE_VERSION "${RELEASE_SERVICE_VERSION_MAJOR}.${RELEASE_SERVICE_VERSION_MINOR}.${RELEASE_SERVICE_VERSION_MICRO}")
0011 project(KOpeningHours VERSION ${RELEASE_SERVICE_VERSION})
0012 
0013 # Ubuntu bionic has ECM 5.44
0014 find_package(ECM 5.44 REQUIRED NO_MODULE)
0015 set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${ECM_MODULE_PATH})
0016 
0017 include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE)
0018 include(ECMAddTests)
0019 include(ECMGenerateHeaders)
0020 include(ECMQtDeclareLoggingCategory)
0021 if (ECM_VERSION VERSION_GREATER_EQUAL 5.91)
0022     include(ECMDeprecationSettings)
0023 else()
0024     # backward compatibility for ECM versions without QtVersionOption.cmake
0025     set(QT_MAJOR_VERSION 5)
0026 endif()
0027 include(ECMSetupVersion)
0028 include(FeatureSummary)
0029 include(KDEInstallDirs)
0030 include(KDECMakeSettings)
0031 include(GenerateExportHeader)
0032 include(ECMAddQch)
0033 
0034 
0035 option(BUILD_QCH "Build API documentation in QCH format (for e.g. Qt Assistant, Qt Creator & KDevelop)" OFF)
0036 add_feature_info(QCH ${BUILD_QCH} "API documentation in QCH format (for e.g. Qt Assistant, Qt Creator & KDevelop)")
0037 
0038 set(CMAKE_CXX_STANDARD 17)
0039 set(CMAKE_CXX_STANDARD_REQUIRED ON)
0040 set(CMAKE_AUTOMOC ON)
0041 set(CMAKE_AUTORCC ON)
0042 ecm_setup_version(PROJECT VARIABLE_PREFIX KOPENINGHOURS
0043     VERSION_HEADER kopeninghours_version.h
0044     PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KOpeningHoursConfigVersion.cmake"
0045     SOVERSION 1
0046 )
0047 
0048 option(VALIDATOR_ONLY "Build only the validator, not the evaluator. This removes the kholidays and ki18n dependencies." OFF)
0049 if (VALIDATOR_ONLY)
0050     set(REQUIRED_QT_VERSION 5.9)
0051 else()
0052     set(REQUIRED_QT_VERSION 5.14) # 5.14 for QCalendar
0053     if (QT_MAJOR_VERSION STREQUAL "6")
0054         set(QT_REQUIRED_VERSION "6.4.0")
0055         set(KF_MIN_VERSION "5.240.0")
0056         set(KF_MAJOR_VERSION "6")
0057     else()
0058         set(KF_MAJOR_VERSION "5")
0059     endif()
0060 endif()
0061 
0062 find_package(Qt${QT_MAJOR_VERSION} ${REQUIRED_QT_VERSION} REQUIRED COMPONENTS Core) # 5.14 for QCalendar
0063 find_package(Qt${QT_MAJOR_VERSION} ${REQUIRED_QT_VERSION} CONFIG QUIET OPTIONAL_COMPONENTS Qml)
0064 if (NOT VALIDATOR_ONLY)
0065     find_package(KF${KF_MAJOR_VERSION} 5.77 REQUIRED COMPONENTS Holidays I18n)
0066 endif()
0067 
0068 if (BUILD_TESTING)
0069     find_package(Qt${QT_MAJOR_VERSION} ${REQUIRED_QT_VERSION} REQUIRED COMPONENTS Test)
0070 endif()
0071 
0072 find_package(FLEX REQUIRED)
0073 set_package_properties(FLEX PROPERTIES PURPOSE "Lexer generator for parsing opening hours expressions")
0074 find_package(BISON REQUIRED)
0075 set_package_properties(BISON PROPERTIES PURPOSE "Grammar generator for parsing opening hours expressions")
0076 
0077 find_package(PythonLibs 3.6 MODULE)
0078 if (PythonLibs_FOUND)
0079     # Extract major/minor python version
0080     string(REPLACE "." ";" VERSION_LIST ${PYTHONLIBS_VERSION_STRING})
0081     list(GET VERSION_LIST 0 PYTHONLIBS_VERSION_MAJOR)
0082     list(GET VERSION_LIST 1 PYTHONLIBS_VERSION_MINOR)
0083 
0084     # boost-python requires exact version number
0085     find_package(Boost COMPONENTS python${PYTHONLIBS_VERSION_MAJOR}${PYTHONLIBS_VERSION_MINOR} MODULE)
0086 endif()
0087 
0088 add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x050d00)
0089 add_definitions(-DKF_DISABLE_DEPRECATED_BEFORE_AND_AT=0x054400)
0090 add_definitions(-DQT_NO_FOREACH)
0091 add_subdirectory(src)
0092 if (Boost_FOUND)
0093     add_subdirectory(PyKOpeningHours)
0094 endif()
0095 
0096 if (BUILD_TESTING)
0097     add_subdirectory(autotests)
0098     add_subdirectory(tests)
0099 endif()
0100 
0101 feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)
0102 
0103 set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KOpeningHours")
0104 configure_package_config_file(
0105     "${CMAKE_CURRENT_SOURCE_DIR}/KOpeningHoursConfig.cmake.in"
0106     "${CMAKE_CURRENT_BINARY_DIR}/KOpeningHoursConfig.cmake"
0107     INSTALL_DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
0108 )
0109 
0110 install(FILES
0111         "${CMAKE_CURRENT_BINARY_DIR}/KOpeningHoursConfig.cmake"
0112         "${CMAKE_CURRENT_BINARY_DIR}/KOpeningHoursConfigVersion.cmake"
0113     DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
0114     COMPONENT Devel
0115 )
0116 install(EXPORT KOpeningHoursTargets DESTINATION "${CMAKECONFIG_INSTALL_DIR}" FILE KOpeningHoursTargets.cmake)
0117 
0118 install(FILES ${CMAKE_CURRENT_BINARY_DIR}/kopeninghours_version.h DESTINATION ${KDE_INSTALL_INCLUDEDIR} COMPONENT Devel)
0119 if (NOT VALIDATOR_ONLY)
0120     ki18n_install(po)
0121 endif()
0122 
0123 if (BUILD_QCH)
0124     ecm_install_qch_export(
0125         TARGETS KOpeningHours_QCH
0126         FILE KOpeningHoursQchTargets.cmake
0127         DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
0128         COMPONENT Devel
0129     )
0130     set(PACKAGE_INCLUDE_QCHTARGETS "include(\"\${CMAKE_CURRENT_LIST_DIR}/KOpeningHoursQchTargets.cmake\")")
0131 endif()