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 "03")
0009 set (RELEASE_SERVICE_VERSION_MICRO "70")
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 endif()
0054 
0055 find_package(Qt${QT_MAJOR_VERSION} ${REQUIRED_QT_VERSION} REQUIRED COMPONENTS Core) # 5.14 for QCalendar
0056 find_package(Qt${QT_MAJOR_VERSION} ${REQUIRED_QT_VERSION} CONFIG QUIET OPTIONAL_COMPONENTS Qml)
0057 if (NOT VALIDATOR_ONLY)
0058     find_package(KF5 5.77 REQUIRED COMPONENTS Holidays I18n)
0059 endif()
0060 
0061 if (BUILD_TESTING)
0062     find_package(Qt${QT_MAJOR_VERSION} ${REQUIRED_QT_VERSION} REQUIRED COMPONENTS Test)
0063 endif()
0064 
0065 find_package(FLEX REQUIRED)
0066 set_package_properties(FLEX PROPERTIES PURPOSE "Lexer generator for parsing opening hours expressions")
0067 find_package(BISON REQUIRED)
0068 set_package_properties(BISON PROPERTIES PURPOSE "Grammar generator for parsing opening hours expressions")
0069 
0070 find_package(PythonLibs 3.6 MODULE)
0071 if (PythonLibs_FOUND)
0072     # Extract major/minor python version
0073     string(REPLACE "." ";" VERSION_LIST ${PYTHONLIBS_VERSION_STRING})
0074     list(GET VERSION_LIST 0 PYTHONLIBS_VERSION_MAJOR)
0075     list(GET VERSION_LIST 1 PYTHONLIBS_VERSION_MINOR)
0076 
0077     # boost-python requires exact version number
0078     find_package(Boost COMPONENTS python${PYTHONLIBS_VERSION_MAJOR}${PYTHONLIBS_VERSION_MINOR} MODULE)
0079 endif()
0080 
0081 add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x050d00)
0082 add_definitions(-DKF_DISABLE_DEPRECATED_BEFORE_AND_AT=0x054400)
0083 add_definitions(-DQT_NO_FOREACH)
0084 add_subdirectory(src)
0085 if (Boost_FOUND)
0086     add_subdirectory(PyKOpeningHours)
0087 endif()
0088 
0089 if (BUILD_TESTING)
0090     add_subdirectory(autotests)
0091     add_subdirectory(tests)
0092 endif()
0093 
0094 feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)
0095 
0096 set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KOpeningHours")
0097 configure_package_config_file(
0098     "${CMAKE_CURRENT_SOURCE_DIR}/KOpeningHoursConfig.cmake.in"
0099     "${CMAKE_CURRENT_BINARY_DIR}/KOpeningHoursConfig.cmake"
0100     INSTALL_DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
0101 )
0102 
0103 install(FILES
0104         "${CMAKE_CURRENT_BINARY_DIR}/KOpeningHoursConfig.cmake"
0105         "${CMAKE_CURRENT_BINARY_DIR}/KOpeningHoursConfigVersion.cmake"
0106     DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
0107     COMPONENT Devel
0108 )
0109 install(EXPORT KOpeningHoursTargets DESTINATION "${CMAKECONFIG_INSTALL_DIR}" FILE KOpeningHoursTargets.cmake)
0110 
0111 install(FILES ${CMAKE_CURRENT_BINARY_DIR}/kopeninghours_version.h DESTINATION ${KDE_INSTALL_INCLUDEDIR} COMPONENT Devel)
0112 if (NOT VALIDATOR_ONLY)
0113     ki18n_install(po)
0114 endif()
0115 
0116 if (BUILD_QCH)
0117     ecm_install_qch_export(
0118         TARGETS KOpeningHours_QCH
0119         FILE KOpeningHoursQchTargets.cmake
0120         DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
0121         COMPONENT Devel
0122     )
0123     set(PACKAGE_INCLUDE_QCHTARGETS "include(\"\${CMAKE_CURRENT_LIST_DIR}/KOpeningHoursQchTargets.cmake\")")
0124 endif()