Warning, /frameworks/syntax-highlighting/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.116.0")
0004 project(KSyntaxHighlighting VERSION ${KF_VERSION})
0005 
0006 find_package(ECM 5.115.0 REQUIRED NO_MODULE)
0007 set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
0008 
0009 include(KDEInstallDirs)
0010 include(KDECMakeSettings)
0011 include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE)
0012 include(KDEGitCommitHooks)
0013 
0014 include(FeatureSummary)
0015 include(GenerateExportHeader)
0016 include(ECMSetupVersion)
0017 include(ECMGenerateHeaders)
0018 include(ECMGeneratePriFile)
0019 include(CMakePackageConfigHelpers)
0020 include(ECMPoQmTools)
0021 include(ECMQtDeclareLoggingCategory)
0022 include(ECMMarkNonGuiExecutable)
0023 include(ECMAddQch)
0024 include(ECMOptionalAddSubdirectory)
0025 include(ECMGenerateExportHeader)
0026 include(ECMDeprecationSettings)
0027 include(ECMQmlModule)
0028 
0029 ecm_setup_version(PROJECT
0030     VARIABLE_PREFIX SyntaxHighlighting
0031     VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/ksyntaxhighlighting_version.h"
0032     PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KF5SyntaxHighlightingConfigVersion.cmake"
0033 )
0034 
0035 set(EXCLUDE_DEPRECATED_BEFORE_AND_AT 0 CACHE STRING "Control the range of deprecated API excluded from the build [default=0].")
0036 
0037 #
0038 # Dependencies
0039 #
0040 set(REQUIRED_QT_VERSION 5.15.2)
0041 find_package(Qt${QT_MAJOR_VERSION} ${REQUIRED_QT_VERSION} NO_MODULE REQUIRED COMPONENTS Core Network Test)
0042 option(KSYNTAXHIGHLIGHTING_USE_GUI "Build components depending on QtGui" ON)
0043 if(KSYNTAXHIGHLIGHTING_USE_GUI)
0044     find_package(Qt${QT_MAJOR_VERSION} ${REQUIRED_QT_VERSION} NO_MODULE REQUIRED COMPONENTS Gui)
0045 endif()
0046 find_package(Qt${QT_MAJOR_VERSION} ${REQUIRED_QT_VERSION} NO_MODULE QUIET OPTIONAL_COMPONENTS PrintSupport Widgets Quick)
0047 set_package_properties(Qt${QT_MAJOR_VERSION} PROPERTIES URL "http://qt-project.org/")
0048 set_package_properties(Qt${QT_MAJOR_VERSION}Widgets PROPERTIES PURPOSE "Example application.")
0049 set_package_properties(Qt${QT_MAJOR_VERSION}PrintSupport PROPERTIES PURPOSE "Example application.")
0050 set_package_properties(Qt${QT_MAJOR_VERSION}Quick PROPERTIES PURPOSE "QtQuick bindings.")
0051 
0052 # QXmlPatters was removed in Qt6
0053 if (QT_MAJOR_VERSION STREQUAL "5")
0054     find_package(Qt5 ${REQUIRED_QT_VERSION} NO_MODULE QUIET OPTIONAL_COMPONENTS XmlPatterns)
0055     set_package_properties(Qt5XmlPatterns PROPERTIES PURPOSE "Compile-time validation of syntax definition files.")
0056 endif()
0057 
0058 find_package(Perl REQUIRED)
0059 set_package_properties(Perl PROPERTIES PURPOSE "Auto-generate PHP syntax definition files.")
0060 
0061 #
0062 # allow to install the "differently" licensed syntax xml files instead of putting them in a QRC and link them in
0063 #
0064 option(QRC_SYNTAX "Bundle the syntax definition files inside the library as resources" ON)
0065 add_feature_info(SYNTAX_RESOURCE ${QRC_SYNTAX} "Bundle the syntax definition files inside the library as resources")
0066 
0067 #
0068 # allow to turn of lookup for syntax files and themes via QStandardPaths
0069 #
0070 option(NO_STANDARD_PATHS "Skip lookup of syntax and theme definitions in QStandardPaths locations" OFF)
0071 add_feature_info(FEATURE_NO_STANDARD_PATHS ${NO_STANDARD_PATHS} "Skip lookup of syntax and theme definitions in QStandardPaths locations")
0072 
0073 #
0074 # API documentation
0075 #
0076 option(BUILD_QCH "Build API documentation in QCH format (for e.g. Qt Assistant, Qt Creator & KDevelop)" OFF)
0077 add_feature_info(QCH ${BUILD_QCH} "API documentation in QCH format (for e.g. Qt Assistant, Qt Creator & KDevelop)")
0078 
0079 #
0080 # Translations
0081 #
0082 ecm_install_po_files_as_qm(poqm)
0083 
0084 # tell the framework if it shall use the syntax files from the resource
0085 if (QRC_SYNTAX)
0086     add_definitions(-DHAS_SYNTAX_RESOURCE)
0087 endif()
0088 
0089 # skip standard paths?
0090 if (NO_STANDARD_PATHS)
0091     add_definitions(-DNO_STANDARD_PATHS)
0092 endif()
0093 
0094 ecm_set_disabled_deprecation_versions(
0095     QT 5.15.2
0096 )
0097 
0098 #
0099 # Actually build the stuff
0100 #
0101 include_directories(${CMAKE_CURRENT_BINARY_DIR})
0102 add_subdirectory(data)
0103 add_subdirectory(src)
0104 if(TARGET Qt${QT_MAJOR_VERSION}::Gui)
0105     add_subdirectory(examples)
0106     if (BUILD_TESTING)
0107         add_subdirectory(autotests)
0108     endif()
0109 endif()
0110 
0111 #
0112 # CMake package config file generation
0113 #
0114 set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KF5SyntaxHighlighting")
0115 
0116 if (BUILD_QCH)
0117     ecm_install_qch_export(
0118         TARGETS KF5SyntaxHighlighting_QCH
0119         FILE KF5SyntaxHighlightingQchTargets.cmake
0120         DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
0121         COMPONENT Devel
0122     )
0123     set(PACKAGE_INCLUDE_QCHTARGETS "include(\"\${CMAKE_CURRENT_LIST_DIR}/KF5SyntaxHighlightingQchTargets.cmake\")")
0124 endif()
0125 
0126 configure_package_config_file(
0127     "${CMAKE_CURRENT_SOURCE_DIR}/KF5SyntaxHighlightingConfig.cmake.in"
0128     "${CMAKE_CURRENT_BINARY_DIR}/KF5SyntaxHighlightingConfig.cmake"
0129     INSTALL_DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
0130 )
0131 
0132 install(FILES
0133         "${CMAKE_CURRENT_BINARY_DIR}/KF5SyntaxHighlightingConfig.cmake"
0134         "${CMAKE_CURRENT_BINARY_DIR}/KF5SyntaxHighlightingConfigVersion.cmake"
0135         DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
0136         COMPONENT Devel)
0137 
0138 if(TARGET KF5SyntaxHighlighting)
0139     install(EXPORT KF5SyntaxHighlightingTargets
0140         DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
0141         FILE KF5SyntaxHighlightingTargets.cmake
0142         NAMESPACE KF5::)
0143 endif()
0144 
0145 install(FILES "${CMAKE_CURRENT_BINARY_DIR}/ksyntaxhighlighting_version.h"
0146         DESTINATION "${KDE_INSTALL_INCLUDEDIR_KF}/KSyntaxHighlighting"
0147         COMPONENT Devel)
0148 
0149 feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)
0150 
0151 # add target to update kate-editor.org syntax page + update site
0152 add_custom_target(update_kate_editor_org
0153     COMMAND "${PERL_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/utils/update-kate-editor-org.pl" "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}")
0154 
0155 kde_configure_git_pre_commit_hook(CHECKS CLANG_FORMAT)