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 "6.0.0") # handled by release scripts
0004 project(KI18n VERSION ${KF_VERSION})
0005
0006 # ECM setup
0007 include(FeatureSummary)
0008 find_package(ECM 5.249.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/KF6I18nConfigVersion.cmake"
0034 SOVERSION 6)
0035
0036 # Dependencies
0037 set(REQUIRED_QT_VERSION 6.5.0)
0038
0039 find_package(Qt6 ${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(Qt6Qml ${REQUIRED_QT_VERSION} CONFIG REQUIRED)
0046 endif()
0047
0048 find_package(LibIntl)
0049 set_package_properties(LibIntl PROPERTIES TYPE REQUIRED
0050 URL "http://gnuwin32.sourceforge.net/packages/libintl.htm"
0051 PURPOSE "Needed for building KI18n unless glibc is the system libc implementation"
0052 )
0053
0054 find_package(IsoCodes)
0055 set_package_properties(IsoCodes PROPERTIES TYPE RUNTIME
0056 PURPOSE "Translation catalogs for countries, country subdivisions, languages and currencies"
0057 )
0058
0059 # KF6I18nMacros.cmake only needs to know the python executable path.
0060 # Due to CMake caching the variables, and KF6I18nMacros being included by KF6I18nConfig,
0061 # we have to hardcode the PYTHON_EXECUTABLE path or anything depending on KF6I18n
0062 # would be unable to find another Python version.
0063 find_package(Python3 REQUIRED COMPONENTS Interpreter)
0064 configure_file(cmake/KF6I18nMacros.cmake.in ${KI18n_BINARY_DIR}/cmake/KF6I18nMacros.cmake @ONLY)
0065 # Needed to build the ki18n translations and run the autotests
0066 file(COPY ${KI18n_SOURCE_DIR}/cmake/build-pofiles.cmake DESTINATION ${KI18n_BINARY_DIR}/cmake)
0067 file(COPY ${KI18n_SOURCE_DIR}/cmake/build-tsfiles.cmake DESTINATION ${KI18n_BINARY_DIR}/cmake)
0068 file(COPY ${KI18n_SOURCE_DIR}/cmake/ts-pmap-compile.py DESTINATION ${KI18n_BINARY_DIR}/cmake)
0069 file(COPY ${KI18n_SOURCE_DIR}/cmake/kf6i18nuic.cmake DESTINATION ${KI18n_BINARY_DIR}/cmake)
0070
0071 # Create dummy file to execute find_package(KF6I18n) within autotests/ki18n_install
0072 file(WRITE ${CMAKE_BINARY_DIR}/cmake/KF6I18nTargets.cmake "")
0073
0074 include(${KI18n_BINARY_DIR}/cmake/KF6I18nMacros.cmake)
0075
0076 remove_definitions(-DQT_NO_CAST_FROM_BYTEARRAY)
0077 if(MSVC)
0078 remove_definitions(-DQT_STRICT_ITERATORS)
0079 endif()
0080
0081 option(BUILD_QCH "Build API documentation in QCH format (for e.g. Qt Assistant, Qt Creator & KDevelop)" OFF)
0082 add_feature_info(QCH ${BUILD_QCH} "API documentation in QCH format (for e.g. Qt Assistant, Qt Creator & KDevelop)")
0083
0084 ecm_set_disabled_deprecation_versions(
0085 QT 6.5
0086 )
0087
0088 ki18n_install(po)
0089 add_subdirectory(src)
0090 if(BUILD_TESTING)
0091 add_subdirectory(autotests)
0092 endif()
0093
0094 # create a Config.cmake and a ConfigVersion.cmake file and install them
0095 set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KF6I18n")
0096
0097 if(BUILD_QCH)
0098 ecm_install_qch_export(
0099 TARGETS KF6I18n_QCH
0100 FILE "${CMAKE_BINARY_DIR}/cmake/KF6I18nQchTargets.cmake"
0101 DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
0102 COMPONENT Devel
0103 )
0104 set(PACKAGE_INCLUDE_QCHTARGETS "include(\"\${CMAKE_CURRENT_LIST_DIR}/KF6I18nQchTargets.cmake\")")
0105 endif()
0106
0107 configure_package_config_file("${CMAKE_CURRENT_LIST_DIR}/KF6I18nConfig.cmake.in"
0108 "${CMAKE_BINARY_DIR}/cmake/KF6I18nConfig.cmake"
0109 INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR}
0110 )
0111
0112 install(FILES "${CMAKE_BINARY_DIR}/cmake/KF6I18nConfig.cmake"
0113 "${CMAKE_BINARY_DIR}/cmake/KF6I18nConfigVersion.cmake"
0114 DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
0115 COMPONENT Devel)
0116
0117 install(EXPORT KF6I18nTargets DESTINATION "${CMAKECONFIG_INSTALL_DIR}" FILE KF6I18nTargets.cmake NAMESPACE KF6::)
0118
0119 install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ki18n_version.h
0120 DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF}/KI18n COMPONENT Devel)
0121
0122 install( FILES
0123 ${KI18n_BINARY_DIR}/cmake/KF6I18nMacros.cmake
0124 cmake/kf6i18nuic.cmake
0125 cmake/build-pofiles.cmake
0126 cmake/build-tsfiles.cmake
0127 cmake/ts-pmap-compile.py
0128 DESTINATION ${CMAKECONFIG_INSTALL_DIR} COMPONENT Devel )
0129
0130 include(ECMFeatureSummary)
0131 ecm_feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
0132
0133 kde_configure_git_pre_commit_hook(CHECKS CLANG_FORMAT)