Warning, /frameworks/ki18n/CMakeLists.txt is written in an unsupported language. File is not indexed.

0001 cmake_minimum_required(VERSION 3.16)
0002 
0003 set(KF_VERSION "5.97.0") # handled by release scripts
0004 project(KI18n VERSION ${KF_VERSION})
0005 
0006 # ECM setup
0007 include(FeatureSummary)
0008 find_package(ECM 5.97.0  NO_MODULE)
0009 set_package_properties(ECM PROPERTIES TYPE REQUIRED DESCRIPTION "Extra CMake Modules." URL "https://commits.kde.org/extra-cmake-modules")
0010 feature_summary(WHAT REQUIRED_PACKAGES_NOT_FOUND FATAL_ON_MISSING_REQUIRED_PACKAGES)
0011 
0012 set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${KI18n_SOURCE_DIR}/cmake ${KI18n_BINARY_DIR}/cmake)
0013 
0014 include(KDEInstallDirs)
0015 include(KDECMakeSettings)
0016 include(KDEGitCommitHooks)
0017 include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE)
0018 
0019 include(ECMGenerateExportHeader)
0020 include(CMakePackageConfigHelpers)
0021 include(ECMSetupVersion)
0022 include(ECMGenerateHeaders)
0023 include(ECMAddQch)
0024 include(ECMQtDeclareLoggingCategory)
0025 include(ECMDeprecationSettings)
0026 include(ECMQmlModule)
0027 
0028 
0029 ecm_setup_version(
0030   PROJECT
0031   VARIABLE_PREFIX KI18N
0032   VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/ki18n_version.h"
0033   PACKAGE_VERSION_FILE "${CMAKE_BINARY_DIR}/cmake/KF5I18nConfigVersion.cmake"
0034   SOVERSION 5)
0035 
0036 # Dependencies
0037 set(REQUIRED_QT_VERSION 5.15.2)
0038 
0039 find_package(Qt${QT_MAJOR_VERSION} ${REQUIRED_QT_VERSION} CONFIG REQUIRED Core)
0040 
0041 set(EXCLUDE_DEPRECATED_BEFORE_AND_AT 0 CACHE STRING "Control the range of deprecated API excluded from the build [default=0].")
0042 
0043 option(BUILD_WITH_QML "Build with support for scripted translations (recommended)" ON)
0044 if (BUILD_WITH_QML)
0045    find_package(Qt${QT_MAJOR_VERSION}Qml ${REQUIRED_QT_VERSION} CONFIG REQUIRED)
0046 endif()
0047 if (ANDROID AND QT_MAJOR_VERSION EQUAL "5")
0048    find_package(Qt5AndroidExtras ${REQUIRED_QT_VERSION} CONFIG REQUIRED)
0049 endif()
0050 
0051 find_package(LibIntl)
0052 set_package_properties(LibIntl PROPERTIES TYPE REQUIRED
0053         URL "http://gnuwin32.sourceforge.net/packages/libintl.htm"
0054         PURPOSE "Needed for building KI18n unless glibc is the system libc implementation"
0055 )
0056 
0057 find_package(IsoCodes)
0058 set_package_properties(IsoCodes PROPERTIES TYPE RUNTIME
0059     PURPOSE "Translation catalogs for countries, country subdivisions, languages and currencies"
0060 )
0061 
0062 # KF5I18nMacros.cmake only needs to know the python executable path.
0063 # Due to CMake caching the variables, and KF5I18nMacros being included by KF5I18nConfig,
0064 # we have to hardcode the PYTHON_EXECUTABLE path or anything depending on KF5I18n
0065 # would be unable to find another Python version.
0066 find_package(PythonInterp REQUIRED)
0067 configure_file(cmake/KF5I18nMacros.cmake.in ${KI18n_BINARY_DIR}/cmake/KF5I18nMacros.cmake @ONLY)
0068 # Needed to build the ki18n translations and run the autotests
0069 file(COPY ${KI18n_SOURCE_DIR}/cmake/build-pofiles.cmake DESTINATION ${KI18n_BINARY_DIR}/cmake)
0070 file(COPY ${KI18n_SOURCE_DIR}/cmake/build-tsfiles.cmake DESTINATION ${KI18n_BINARY_DIR}/cmake)
0071 file(COPY ${KI18n_SOURCE_DIR}/cmake/ts-pmap-compile.py DESTINATION ${KI18n_BINARY_DIR}/cmake)
0072 file(COPY ${KI18n_SOURCE_DIR}/cmake/kf5i18nuic.cmake DESTINATION ${KI18n_BINARY_DIR}/cmake)
0073 
0074 # Create dummy file to execute find_package(KF5I18n) within autotests/ki18n_install
0075 file(WRITE ${CMAKE_BINARY_DIR}/cmake/KF5I18nTargets.cmake "")
0076 
0077 include(${KI18n_BINARY_DIR}/cmake/KF5I18nMacros.cmake)
0078 
0079 remove_definitions(-DQT_NO_CAST_FROM_BYTEARRAY)
0080 if(MSVC)
0081     remove_definitions(-DQT_STRICT_ITERATORS)
0082 endif()
0083 
0084 option(BUILD_QCH "Build API documentation in QCH format (for e.g. Qt Assistant, Qt Creator & KDevelop)" OFF)
0085 add_feature_info(QCH ${BUILD_QCH} "API documentation in QCH format (for e.g. Qt Assistant, Qt Creator & KDevelop)")
0086 
0087 ecm_set_disabled_deprecation_versions(
0088     QT 5.15.2
0089 )
0090 
0091 ki18n_install(po)
0092 add_subdirectory(src)
0093 if (BUILD_TESTING)
0094     add_subdirectory(autotests)
0095 endif()
0096 
0097 # create a Config.cmake and a ConfigVersion.cmake file and install them
0098 set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KF5I18n")
0099 
0100 if (BUILD_QCH)
0101     ecm_install_qch_export(
0102         TARGETS KF5I18n_QCH
0103         FILE "${CMAKE_BINARY_DIR}/cmake/KF5I18nQchTargets.cmake"
0104         DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
0105         COMPONENT Devel
0106     )
0107     set(PACKAGE_INCLUDE_QCHTARGETS "include(\"\${CMAKE_CURRENT_LIST_DIR}/KF5I18nQchTargets.cmake\")")
0108 endif()
0109 
0110 configure_package_config_file("${CMAKE_CURRENT_LIST_DIR}/KF5I18nConfig.cmake.in"
0111                               "${CMAKE_BINARY_DIR}/cmake/KF5I18nConfig.cmake"
0112                               INSTALL_DESTINATION  ${CMAKECONFIG_INSTALL_DIR}
0113 )
0114 
0115 install(FILES  "${CMAKE_BINARY_DIR}/cmake/KF5I18nConfig.cmake"
0116                "${CMAKE_BINARY_DIR}/cmake/KF5I18nConfigVersion.cmake"
0117         DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
0118         COMPONENT Devel)
0119 
0120 install(EXPORT KF5I18nTargets DESTINATION "${CMAKECONFIG_INSTALL_DIR}" FILE KF5I18nTargets.cmake NAMESPACE KF5::)
0121 
0122 install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ki18n_version.h
0123         DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF}/KI18n COMPONENT Devel)
0124 
0125 install( FILES
0126     ${KI18n_BINARY_DIR}/cmake/KF5I18nMacros.cmake
0127     cmake/kf5i18nuic.cmake
0128     cmake/build-pofiles.cmake
0129     cmake/build-tsfiles.cmake
0130     cmake/ts-pmap-compile.py
0131     DESTINATION ${CMAKECONFIG_INSTALL_DIR} COMPONENT Devel )
0132 
0133 feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
0134 
0135 kde_configure_git_pre_commit_hook(CHECKS CLANG_FORMAT)