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

0001 cmake_minimum_required(VERSION 3.16)
0002 
0003 # KDE Gear version, managed by release service script
0004 set(RELEASE_SERVICE_VERSION_MAJOR "24")
0005 set(RELEASE_SERVICE_VERSION_MINOR "04")
0006 set(RELEASE_SERVICE_VERSION_MICRO "70")
0007 
0008 set(RELEASE_SERVICE_VERSION "${RELEASE_SERVICE_VERSION_MAJOR}.${RELEASE_SERVICE_VERSION_MINOR}.${RELEASE_SERVICE_VERSION_MICRO}")
0009 
0010 # generate patch level from release service version
0011 set(_micro ${RELEASE_SERVICE_VERSION_MICRO})
0012 if (_micro LESS "10")
0013     string(PREPEND _micro "0") # pad with 0
0014 endif()
0015 set(RELEASE_SERVICE_BASED_PATCHLEVEL "${RELEASE_SERVICE_VERSION_MAJOR}${RELEASE_SERVICE_VERSION_MINOR}${_micro}")
0016 
0017 # The math expression below automatically increments KDevelop minor version in each KDE Gear release.
0018 # The multiplier 3 is the number of releases that share ${RELEASE_SERVICE_VERSION_MAJOR}.
0019 # The fraction assigns consecutive minor versions to the 3 releases - 04, 08 and 12. The rounding up groups
0020 # pre-release versions with the corresponding final release versions: 03 with 04, 07 with 08 and 11 with 12.
0021 # The final subtrahend at the end of the expression ensures version continuity: KDevelop 5.11 in KDE Gear 23.04.
0022 math(EXPR KDEVELOP_OWN_MINOR_VERSION "${RELEASE_SERVICE_VERSION_MAJOR} * 3                  \
0023                                       + (${RELEASE_SERVICE_VERSION_MINOR} + 4 - 3) / 4      \
0024                                       - 59")
0025 
0026 # On macOS KDevelop_VERSION_MINOR is modified below. But KDEV_ITEMREPOSITORY_VERSION should depend on the
0027 # original minor version on all platforms. So the variable ${KDEVELOP_OWN_MINOR_VERSION} is used again later.
0028 project(KDevelop VERSION "5.${KDEVELOP_OWN_MINOR_VERSION}.${RELEASE_SERVICE_BASED_PATCHLEVEL}")
0029 
0030 # KDevelop SOVERSION
0031 # E.g. for KDevelop 5.2.0 => SOVERSION 52 (we only promise ABI compatibility between patch version updates)
0032 set(KDEVELOP_SOVERSION "${KDevelop_VERSION_MAJOR}${KDevelop_VERSION_MINOR}")
0033 
0034 if (APPLE)
0035     ###################################################################################
0036     # Kludge for bug #448152: ld: malformed 64-bit a.b.c.d.e version number: 5.7.211201
0037     # Apple's linker uses the project version (not the SOVERSION) to calculate an
0038     # unsigned int in such a way that places restrictions on the magnitude of each tier
0039     # of the version string.
0040     # See here: https://www.sicpers.info/2013/03/how-to-version-a-mach-o-library/
0041     ###################################################################################
0042     project(KDevelop VERSION "${KDevelop_VERSION_MAJOR}.${RELEASE_SERVICE_VERSION_MAJOR}.${RELEASE_SERVICE_VERSION_MINOR}.${_micro}")
0043 endif()
0044 
0045 # plugin version as used e.g. in plugin installation path
0046 set(KDEV_PLUGIN_VERSION "${KDEVELOP_SOVERSION}")
0047 
0048 set(QT_MIN_VERSION "5.15.2")
0049 set(KF5_DEP_VERSION "5.91.0")
0050 
0051 # we need some parts of the ECM CMake helpers
0052 find_package (ECM ${KF5_DEP_VERSION} REQUIRED NO_MODULE)
0053 set(CMAKE_MODULE_PATH ${KDevelop_SOURCE_DIR}/cmake/modules ${ECM_MODULE_PATH})
0054 
0055 include(KDEInstallDirs)
0056 include(KDECMakeSettings)
0057 include(KDECompilerSettings NO_POLICY_SCOPE) # needs to be first, as set policies influence following macros
0058 include(ECMOptionalAddSubdirectory)
0059 include(ECMInstallIcons)
0060 include(ECMAddAppIcon)
0061 include(ECMSetupVersion)
0062 include(ECMAddTests)
0063 include(ECMMarkNonGuiExecutable)
0064 include(ECMGenerateHeaders)
0065 include(ECMQtDeclareLoggingCategory)
0066 include(ECMDeprecationSettings)
0067 include(GenerateExportHeader)
0068 include(CMakePackageConfigHelpers)
0069 include(FeatureSummary)
0070 include(WriteBasicConfigVersionFile)
0071 include(CheckFunctionExists)
0072 include(KDevelopMacrosInternal)
0073 
0074 
0075 find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED Widgets Concurrent Quick QuickWidgets)
0076 if(BUILD_TESTING)
0077   find_package(Qt5Test ${QT_MIN_VERSION} CONFIG REQUIRED)
0078 endif()
0079 
0080 find_package(KF5 ${KF5_DEP_VERSION} REQUIRED COMPONENTS
0081   Config
0082   Declarative
0083   DocTools
0084   IconThemes
0085   I18n
0086   ItemModels
0087   ItemViews
0088   JobWidgets
0089   KCMUtils
0090   KIO
0091   NewStuff
0092   NotifyConfig
0093   Parts
0094   Service
0095   TextEditor
0096   ThreadWeaver
0097   XmlGui
0098   WindowSystem
0099   Crash
0100   GuiAddons
0101   Archive
0102   Notifications
0103 )
0104 
0105 set(HAVE_KSYSGUARD FALSE)
0106 find_package(KSysGuard CONFIG QUIET)
0107 set_package_properties(KSysGuard PROPERTIES
0108     PURPOSE "Framework for process listing. Required for the 'Attach to Process' feature"
0109     TYPE RECOMMENDED
0110 )
0111 if(NOT KSysGuard_FOUND)
0112     # try old pre-Plasma 5.19 name
0113     find_package(KF5SysGuard CONFIG)
0114     set_package_properties(KF5SysGuard PROPERTIES
0115         PURPOSE "Framework for process listing (older name of KSysGuard). Required for the 'Attach to Process' feature"
0116         TYPE RECOMMENDED
0117     )
0118 endif()
0119 if(KSysGuard_FOUND OR KF5SysGuard_FOUND)
0120     set(HAVE_KSYSGUARD TRUE)
0121 endif()
0122 
0123 find_package(KDevelop-PG-Qt 1.90.90 CONFIG)
0124 set_package_properties(KDevelop-PG-Qt PROPERTIES
0125     PURPOSE "KDevelop parser generator library. Required for the QMake Builder/Manager plugin."
0126     TYPE RECOMMENDED
0127 )
0128 
0129 find_package(SharedMimeInfo 1.9 REQUIRED)
0130 
0131 # added by KDE_COMPILERSETTINGS_LEVEL 5.85.0
0132 remove_definitions(
0133     -DQT_NO_KEYWORDS
0134 )
0135 add_definitions(
0136     -DQT_NO_SIGNALS_SLOTS_KEYWORDS
0137 )
0138 ecm_set_disabled_deprecation_versions(
0139     QT 5.15 # Note: unset for plugins/qmljs/3rdparty/qtcreator-libs
0140     KF 5.91
0141     KI18N 5.88 # I18N_NOOP
0142 )
0143 
0144 # Turn off missing-field-initializers warning for GCC to avoid noise from false positives with empty {}
0145 # See discussion: https://mail.kde.org/pipermail/kdevelop-devel/2014-February/046910.html
0146 add_compile_flag_if_supported(-Wno-missing-field-initializers)
0147 add_compile_flag_if_supported(-Werror=switch)
0148 add_compile_flag_if_supported(-Werror=undefined-bool-conversion)
0149 add_compile_flag_if_supported(-Werror=tautological-undefined-compare)
0150 add_compile_flag_if_supported(-Werror=implicit-fallthrough)    # Use [[fallthrough]] for false positives.
0151 if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
0152     add_compile_flag_if_supported(-Wdocumentation)
0153     add_compile_flag_if_supported(-Wcovered-switch-default)
0154     add_compile_flag_if_supported(-Wunreachable-code-break)
0155     # This warning is triggered by every call to qCDebug()
0156     add_compile_flag_if_supported(-Wno-gnu-zero-variadic-macro-arguments)
0157 endif()
0158 if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
0159     add_compile_flag_if_supported(-pedantic)
0160     add_compile_flag_if_supported(-Wzero-as-null-pointer-constant CXX_ONLY)
0161 endif()
0162 if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
0163     add_compile_flag_if_supported(-Wsuggest-override CXX_ONLY)
0164 endif()
0165 
0166 string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_TOLOWER)
0167 if(CMAKE_BUILD_TYPE_TOLOWER MATCHES "debug"
0168   OR CMAKE_BUILD_TYPE_TOLOWER STREQUAL "")
0169   set(COMPILER_OPTIMIZATIONS_ENABLED OFF)
0170 else()
0171   set(COMPILER_OPTIMIZATIONS_ENABLED ON)
0172 endif()
0173 
0174 option(BUILD_BENCHMARKS "Whether benchmarks should be compiled or not" ${COMPILER_OPTIMIZATIONS_ENABLED})
0175 
0176 # create config-kdevelop.h
0177 configure_file(config-kdevelop.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-kdevelop.h)
0178 include_directories(${KDevelop_BINARY_DIR}) # for config-kdevelop.h
0179 
0180 add_subdirectory(3rdparty/timsort)
0181 
0182 add_subdirectory(kdevplatform)
0183 add_subdirectory(plugins)
0184 
0185 add_subdirectory(pics)
0186 add_subdirectory(app)
0187 add_subdirectory(app_templates)
0188 add_subdirectory(file_templates)
0189 add_subdirectory(shortcuts)
0190 add_subdirectory(doc)
0191 add_subdirectory(share)
0192 
0193 set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KDevelop")
0194 configure_package_config_file("${CMAKE_CURRENT_SOURCE_DIR}/KDevelopConfig.cmake.in"
0195                                   "${CMAKE_CURRENT_BINARY_DIR}/KDevelopConfig.cmake"
0196                                   INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR}
0197 )
0198 ecm_setup_version(PROJECT
0199                   VARIABLE_PREFIX KDEVELOP
0200                   VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/kdevelop_version.h"
0201                   PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KDevelopConfigVersion.cmake"
0202 )
0203 install(FILES
0204         "${CMAKE_CURRENT_BINARY_DIR}/kdevelop_version.h"
0205         DESTINATION "${KDE_INSTALL_INCLUDEDIR}/kdevelop")
0206 install(FILES
0207         "${CMAKE_CURRENT_BINARY_DIR}/KDevelopConfig.cmake"
0208         "${CMAKE_CURRENT_BINARY_DIR}/KDevelopConfigVersion.cmake"
0209         DESTINATION "${CMAKECONFIG_INSTALL_DIR}" )
0210 install(EXPORT KDevelopTargets DESTINATION "${CMAKECONFIG_INSTALL_DIR}" NAMESPACE KDev:: FILE KDevelopTargets.cmake)
0211 
0212 # kdebugsettings file
0213 install_qt_logging_categories(TYPE APP_PLUGIN)
0214 
0215 install(FILES org.kde.kdevelop.appdata.xml DESTINATION ${KDE_INSTALL_METAINFODIR})
0216 
0217 # Make it possible to use the po files fetched by the fetch-translations step
0218 ki18n_install(po)
0219 kdoctools_install(po)
0220 
0221 feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)