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 "22")
0005 set(RELEASE_SERVICE_VERSION_MINOR "08")
0006 set(RELEASE_SERVICE_VERSION_MICRO "1")
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 project(KDevelop VERSION "5.9.${RELEASE_SERVICE_BASED_PATCHLEVEL}")
0018 
0019 # KDevelop SOVERSION
0020 # E.g. for KDevelop 5.2.0 => SOVERSION 52 (we only promise ABI compatibility between patch version updates)
0021 set(KDEVELOP_SOVERSION "${KDevelop_VERSION_MAJOR}${KDevelop_VERSION_MINOR}")
0022 
0023 # On macOS KDevelop_VERSION_MINOR is modified below. But KDEV_ITEMREPOSITORY_VERSION should depend
0024 # on the original minor version on all platforms. So we store the original version in a variable.
0025 set(KDEVELOP_OWN_MINOR_VERSION "${KDevelop_VERSION_MINOR}")
0026 
0027 if (APPLE)
0028     ###################################################################################
0029     # Kludge for bug #448152: ld: malformed 64-bit a.b.c.d.e version number: 5.7.211201
0030     # Apple's linker uses the project version (not the SOVERSION) to calculate an
0031     # unsigned int in such a way that places restrictions on the magnitude of each tier
0032     # of the version string.
0033     # See here: https://www.sicpers.info/2013/03/how-to-version-a-mach-o-library/
0034     ###################################################################################
0035     project(KDevelop VERSION "${KDevelop_VERSION_MAJOR}.${RELEASE_SERVICE_VERSION_MAJOR}.${RELEASE_SERVICE_VERSION_MINOR}.${_micro}")
0036 endif()
0037 
0038 # plugin version as used e.g. in plugin installation path
0039 # started off as 30 when 5.2 was released, incremented along the SO version so far
0040 # TODO: perhaps switch directly to KDEVELOP_SOVERSION?
0041 math(EXPR KDEV_PLUGIN_VERSION "30 + ${KDEVELOP_SOVERSION} - 52")
0042 
0043 set(CMAKE_CXX_STANDARD 17)
0044 set(CMAKE_CXX_STANDARD_REQUIRED YES)
0045 set(QT_MIN_VERSION "5.15.0")
0046 set(KF5_DEP_VERSION "5.78.0")
0047 
0048 # we need some parts of the ECM CMake helpers
0049 find_package (ECM ${KF5_DEP_VERSION} REQUIRED NO_MODULE)
0050 set(CMAKE_MODULE_PATH ${KDevelop_SOURCE_DIR}/cmake/modules ${ECM_MODULE_PATH})
0051 
0052 include(KDEInstallDirs)
0053 include(KDECMakeSettings)
0054 include(KDECompilerSettings NO_POLICY_SCOPE) # needs to be first, as set policies influence following macros
0055 include(ECMOptionalAddSubdirectory)
0056 include(ECMInstallIcons)
0057 include(ECMAddAppIcon)
0058 include(ECMSetupVersion)
0059 include(ECMAddTests)
0060 include(ECMMarkNonGuiExecutable)
0061 include(ECMGenerateHeaders)
0062 include(ECMQtDeclareLoggingCategory)
0063 include(GenerateExportHeader)
0064 include(CMakePackageConfigHelpers)
0065 include(FeatureSummary)
0066 include(WriteBasicConfigVersionFile)
0067 include(CheckFunctionExists)
0068 include(KDevelopMacrosInternal)
0069 
0070 
0071 find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED Widgets Concurrent Quick QuickWidgets)
0072 if(BUILD_TESTING)
0073   find_package(Qt5Test ${QT_MIN_VERSION} CONFIG REQUIRED)
0074 endif()
0075 
0076 find_package(KF5 ${KF5_DEP_VERSION} REQUIRED COMPONENTS
0077   Config
0078   Declarative
0079   DocTools
0080   IconThemes
0081   I18n
0082   ItemModels
0083   ItemViews
0084   JobWidgets
0085   KCMUtils
0086   KIO
0087   NewStuff
0088   NotifyConfig
0089   Parts
0090   Service
0091   TextEditor
0092   ThreadWeaver
0093   XmlGui
0094   WindowSystem
0095   Crash
0096   GuiAddons
0097   Archive
0098   Notifications
0099 )
0100 
0101 set(HAVE_KSYSGUARD FALSE)
0102 find_package(KSysGuard CONFIG QUIET)
0103 set_package_properties(KSysGuard PROPERTIES
0104     PURPOSE "Framework for process listing. Required for the 'Attach to Process' feature"
0105     TYPE RECOMMENDED
0106 )
0107 if(NOT KSysGuard_FOUND)
0108     # try old pre-Plasma 5.19 name
0109     find_package(KF5SysGuard CONFIG)
0110     set_package_properties(KF5SysGuard PROPERTIES
0111         PURPOSE "Framework for process listing (older name of KSysGuard). Required for the 'Attach to Process' feature"
0112         TYPE RECOMMENDED
0113     )
0114 endif()
0115 if(KSysGuard_FOUND OR KF5SysGuard_FOUND)
0116     set(HAVE_KSYSGUARD TRUE)
0117 endif()
0118 
0119 find_package(KDevelop-PG-Qt 1.90.90 CONFIG)
0120 set_package_properties(KDevelop-PG-Qt PROPERTIES
0121     PURPOSE "KDevelop parser generator library. Required for the QMake Builder/Manager plugin."
0122     TYPE RECOMMENDED
0123 )
0124 
0125 find_package(SharedMimeInfo 1.9 REQUIRED)
0126 
0127 add_definitions(
0128     -DQT_DEPRECATED_WARNINGS
0129     -DQT_DISABLE_DEPRECATED_BEFORE=0x050900
0130     -DQT_DEPRECATED_WARNINGS_SINCE=0x060000
0131     -DQT_NO_SIGNALS_SLOTS_KEYWORDS
0132     -DQT_NO_URL_CAST_FROM_STRING
0133     -DQT_NO_CAST_FROM_ASCII
0134     -DQT_NO_CAST_TO_ASCII
0135     -DQT_NO_CAST_FROM_BYTEARRAY
0136     -DQT_STRICT_ITERATORS
0137     -DQT_USE_QSTRINGBUILDER
0138     -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT
0139     -DKF_DISABLE_DEPRECATED_BEFORE_AND_AT=0x053200
0140     -DKF_DEPRECATED_WARNINGS_SINCE=0x060000
0141     -DQT_NO_FOREACH
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 Q_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 # CTestCustom.cmake has to be in the CTEST_BINARY_DIR.
0216 # in the KDE build system, this is the same as CMAKE_BINARY_DIR.
0217 configure_file(${CMAKE_SOURCE_DIR}/CTestCustom.cmake ${CMAKE_BINARY_DIR}/CTestCustom.cmake)
0218 
0219 install(FILES org.kde.kdevelop.appdata.xml DESTINATION ${KDE_INSTALL_METAINFODIR})
0220 
0221 # Make it possible to use the po files fetched by the fetch-translations step
0222 ki18n_install(po)
0223 kdoctools_install(po)
0224 
0225 feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)