Changeset View
Changeset View
Standalone View
Standalone View
CMakeLists.txt
1 | cmake_minimum_required(VERSION 3.0) | 1 | project(KDevPlatform LANGUAGES NONE) | ||
---|---|---|---|---|---|
2 | project(KDevPlatform) | | |||
3 | 2 | | |||
4 | # kdevplatform version | 3 | message(FATAL_ERROR "kdevplatform was merged into kdevelop.git") | ||
5 | set(KDEVPLATFORM_VERSION_MAJOR 5) | | |||
6 | set(KDEVPLATFORM_VERSION_MINOR 1) | | |||
7 | set(KDEVPLATFORM_VERSION_PATCH 40) | | |||
8 | set(KDEVPLATFORM_VERSION "${KDEVPLATFORM_VERSION_MAJOR}.${KDEVPLATFORM_VERSION_MINOR}.${KDEVPLATFORM_VERSION_PATCH}") | | |||
9 | | ||||
10 | # plugin versions listed in the .desktop files | | |||
11 | set(KDEV_PLUGIN_VERSION 29) | | |||
12 | # Increase this to reset incompatible item-repositories | | |||
13 | set(KDEV_ITEMREPOSITORY_VERSION 87) | | |||
14 | | ||||
15 | # library version / SO version | | |||
16 | set(KDEVPLATFORM_LIB_SOVERSION 10) | | |||
17 | | ||||
18 | # we need some parts of the ECM CMake helpers | | |||
19 | find_package (ECM "5.14.0" REQUIRED NO_MODULE) | | |||
20 | set(CMAKE_MODULE_PATH ${KDevPlatform_SOURCE_DIR}/cmake/modules ${ECM_MODULE_PATH}) | | |||
21 | | ||||
22 | include(KDECompilerSettings NO_POLICY_SCOPE) | | |||
23 | include(ECMAddTests) | | |||
24 | include(ECMOptionalAddSubdirectory) | | |||
25 | include(ECMInstallIcons) | | |||
26 | include(ECMSetupVersion) | | |||
27 | include(ECMMarkAsTest) | | |||
28 | include(ECMMarkNonGuiExecutable) | | |||
29 | include(ECMGenerateHeaders) | | |||
30 | include(ECMQtDeclareLoggingCategory) | | |||
31 | include(GenerateExportHeader) | | |||
32 | include(FeatureSummary) | | |||
33 | include(WriteBasicConfigVersionFile) | | |||
34 | include(CheckFunctionExists) | | |||
35 | include(CMakePackageConfigHelpers) | | |||
36 | include(KDEInstallDirs) | | |||
37 | include(KDECMakeSettings) | | |||
38 | include(KDevPlatformMacros) | | |||
39 | | ||||
40 | set(QT_MIN_VERSION "5.5.0") | | |||
41 | find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED Core DBus Widgets Concurrent Test) | | |||
42 | | ||||
43 | if(BUILD_TESTING) | | |||
44 | find_package(Qt5Test ${QT_MIN_VERSION} CONFIG REQUIRED) | | |||
45 | endif() | | |||
46 | find_package(Qt5QuickWidgets ${QT_MIN_VERSION} CONFIG) | | |||
47 | set_package_properties(Qt5QuickWidgets PROPERTIES | | |||
48 | PURPOSE "Qt5 QuickWidgets library (part of Qt >=5.3). Required for the Welcome Page plugin." | | |||
49 | TYPE RECOMMENDED | | |||
50 | ) | | |||
51 | | ||||
52 | set(KF5_DEP_VERSION "5.18.0") # need KAboutData::fromPluginMetaData in kcoreaddons | | |||
53 | find_package(KF5 ${KF5_DEP_VERSION} REQUIRED COMPONENTS | | |||
54 | Archive | | |||
55 | Config | | |||
56 | GuiAddons | | |||
57 | WidgetsAddons | | |||
58 | IconThemes | | |||
59 | I18n | | |||
60 | ItemModels | | |||
61 | ItemViews | | |||
62 | JobWidgets | | |||
63 | KCMUtils | | |||
64 | KIO | | |||
65 | NewStuff | | |||
66 | Notifications | | |||
67 | NotifyConfig | | |||
68 | Parts | | |||
69 | Service | | |||
70 | Sonnet | | |||
71 | TextEditor | | |||
72 | ThreadWeaver | | |||
73 | WindowSystem | | |||
74 | Declarative | | |||
75 | XmlGui | | |||
76 | ) | | |||
77 | | ||||
78 | find_package(Grantlee5 CONFIG) | | |||
79 | set_package_properties(Grantlee5 PROPERTIES | | |||
80 | PURPOSE "Grantlee templating library, needed for file templates" | | |||
81 | URL "http://www.grantlee.org/" | | |||
82 | TYPE RECOMMENDED) | | |||
83 | | ||||
84 | set(Boost_ADDITIONAL_VERSIONS 1.39.0 1.39) | | |||
85 | find_package(Boost 1.35.0) | | |||
86 | set_package_properties(Boost PROPERTIES | | |||
87 | PURPOSE "Boost libraries for enabling the classbrowser" | | |||
88 | URL "http://www.boost.org" | | |||
89 | TYPE REQUIRED) | | |||
90 | | ||||
91 | add_definitions( | | |||
92 | -DQT_DEPRECATED_WARNINGS | | |||
93 | -DQT_DISABLE_DEPRECATED_BEFORE=0x050400 | | |||
94 | -DQT_NO_SIGNALS_SLOTS_KEYWORDS | | |||
95 | -DQT_NO_URL_CAST_FROM_STRING | | |||
96 | -DQT_STRICT_ITERATORS | | |||
97 | -DQT_USE_FAST_CONCATENATION | | |||
98 | -DQT_USE_FAST_OPERATOR_PLUS | | |||
99 | ) | | |||
100 | | ||||
101 | function(add_compile_flag_if_supported _flag) | | |||
102 | unset(_have_flag CACHE) | | |||
103 | string(REGEX REPLACE "[-=]" "_" _varname ${_flag}) | | |||
104 | string(TOUPPER ${_varname} _varname) | | |||
105 | set(_varname "HAVE${_varname}") | | |||
106 | check_cxx_compiler_flag("${_flag}" "${_varname}") | | |||
107 | if (${${_varname}}) | | |||
108 | add_compile_options(${_flag}) | | |||
109 | endif() | | |||
110 | endfunction() | | |||
111 | | ||||
112 | # Turn off missing-field-initializers warning for GCC to avoid noise from false positives with empty {} | | |||
113 | # See discussion: http://mail.kde.org/pipermail/kdevelop-devel/2014-February/046910.html | | |||
114 | add_compile_flag_if_supported(-Wno-missing-field-initializers) | | |||
115 | add_compile_flag_if_supported(-Werror=undefined-bool-conversion) | | |||
116 | add_compile_flag_if_supported(-Werror=tautological-undefined-compare) | | |||
117 | if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") | | |||
118 | add_compile_flag_if_supported(-Wdocumentation) | | |||
119 | # This warning is triggered by every call to qCDebug() | | |||
120 | add_compile_flag_if_supported(-Wno-gnu-zero-variadic-macro-arguments) | | |||
121 | endif() | | |||
122 | if (CMAKE_COMPILER_CXX_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") | | |||
123 | add_compile_flag_if_supported(-pedantic) | | |||
124 | endif() | | |||
125 | | ||||
126 | configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/config-kdevplatform.h.cmake | | |||
127 | ${CMAKE_CURRENT_BINARY_DIR}/config-kdevplatform.h ) | | |||
128 | | ||||
129 | include_directories(${KDevPlatform_SOURCE_DIR} ${KDevPlatform_BINARY_DIR}) | | |||
130 | | ||||
131 | string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_TOLOWER) | | |||
132 | if(CMAKE_BUILD_TYPE_TOLOWER MATCHES "debug" | | |||
133 | OR CMAKE_BUILD_TYPE_TOLOWER STREQUAL "") | | |||
134 | set(COMPILER_OPTIMIZATIONS_DISABLED TRUE) | | |||
135 | else() | | |||
136 | set(COMPILER_OPTIMIZATIONS_DISABLED FALSE) | | |||
137 | endif() | | |||
138 | | ||||
139 | add_subdirectory(sublime) | | |||
140 | add_subdirectory(interfaces) | | |||
141 | add_subdirectory(project) | | |||
142 | add_subdirectory(language) | | |||
143 | add_subdirectory(shell) | | |||
144 | add_subdirectory(util) | | |||
145 | add_subdirectory(outputview) | | |||
146 | add_subdirectory(vcs) | | |||
147 | add_subdirectory(pics) | | |||
148 | add_subdirectory(debugger) | | |||
149 | add_subdirectory(documentation) | | |||
150 | add_subdirectory(serialization) | | |||
151 | add_subdirectory(template) | | |||
152 | if(BUILD_TESTING) | | |||
153 | add_subdirectory(tests) | | |||
154 | endif() | | |||
155 | add_subdirectory(plugins) | | |||
156 | | ||||
157 | set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KDevPlatform") | | |||
158 | | ||||
159 | configure_package_config_file("${CMAKE_CURRENT_SOURCE_DIR}/KDevPlatformConfig.cmake.in" | | |||
160 | "${CMAKE_CURRENT_BINARY_DIR}/KDevPlatformConfig.cmake" | | |||
161 | INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR} | | |||
162 | ) | | |||
163 | | ||||
164 | ecm_setup_version(${KDEVPLATFORM_VERSION_MAJOR}.${KDEVPLATFORM_VERSION_MINOR}.${KDEVPLATFORM_VERSION_PATCH} | | |||
165 | VARIABLE_PREFIX KDEVPLATFORM | | |||
166 | VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/kdevplatform_version.h" | | |||
167 | PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KDevPlatformConfigVersion.cmake" | | |||
168 | SOVERSION ${KDEVPLATFORM_LIB_SOVERSION}) | | |||
169 | | ||||
170 | install( FILES | | |||
171 | "${KDevPlatform_BINARY_DIR}/kdevplatform_version.h" | | |||
172 | "${KDevPlatform_BINARY_DIR}/config-kdevplatform.h" | | |||
173 | DESTINATION "${KDE_INSTALL_INCLUDEDIR}/kdevplatform" ) | | |||
174 | install( FILES | | |||
175 | "${KDevPlatform_BINARY_DIR}/KDevPlatformConfig.cmake" | | |||
176 | "${KDevPlatform_BINARY_DIR}/KDevPlatformConfigVersion.cmake" | | |||
177 | cmake/modules/KDevPlatformMacros.cmake | | |||
178 | DESTINATION "${CMAKECONFIG_INSTALL_DIR}" ) | | |||
179 | install( EXPORT KDevPlatformTargets | | |||
180 | DESTINATION "${CMAKECONFIG_INSTALL_DIR}" | | |||
181 | NAMESPACE KDev:: | | |||
182 | FILE KDevPlatformTargets.cmake ) | | |||
183 | | ||||
184 | # kdebugsettings file | | |||
185 | install( FILES kdevplatform.categories DESTINATION ${KDE_INSTALL_CONFDIR} ) | | |||
186 | | ||||
187 | # CTestCustom.cmake has to be in the CTEST_BINARY_DIR. | | |||
188 | # in the KDE build system, this is the same as CMAKE_BINARY_DIR. | | |||
189 | configure_file(${CMAKE_SOURCE_DIR}/CTestCustom.cmake ${CMAKE_BINARY_DIR}/CTestCustom.cmake) | | |||
190 | | ||||
191 | feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES) | |