1ECM-KDE-MODULES(7)            Extra CMake Modules           ECM-KDE-MODULES(7)
2
3
4

NAME

6       ecm-kde-modules - ECM KDE Modules Reference
7

INTRODUCTION

9       Extra CMake Modules (ECM) provides several modules that provide default
10       settings (like installation directories, compiler flags and other CMake
11       options) aimed at software produced by the KDE modules; these are docu‐
12       mented here. ECM also provides modules with more general functionality,
13       documented in ecm-modules(7), and ones that extend the functionality of
14       the find_package command, documented in ecm-find-modules(7).
15
16       To use these modules, you need to tell CMake to find the  ECM  package,
17       and  then add either ${ECM_MODULE_PATH} or ${ECM_KDE_MODULE_DIR} to the
18       CMAKE_MODULE_PATH variable:
19
20          find_package(ECM REQUIRED NO_MODULE)
21          set(CMAKE_MODULE_PATH ${ECM_MODULE_DIR})
22
23       Using ${ECM_MODULE_PATH} will also make  the  other  types  of  modules
24       available.
25

ALL KDE MODULES

27   KDECMakeSettings
28       Changes  various CMake settings to what the KDE community views as more
29       sensible defaults.
30
31       It is recommended to include this module with the NO_POLICY_SCOPE flag,
32       otherwise you may get spurious warnings with some versions of CMake.
33
34       It  is  split  into three parts, which can be independently disabled if
35       desired.
36
37   Runtime Paths
38       The default runtime path (used on Unix systems to  search  for  dynami‐
39       cally-linked  libraries)  is set to include the location that libraries
40       will be installed to (as set in LIB_INSTALL_DIR or, if  the  former  is
41       not set, KDE_INSTALL_LIBDIR), and also the linker search path.
42
43       Note  that LIB_INSTALL_DIR or alternatively KDE_INSTALL_LIBDIR needs to
44       be set before including this module.  Typically, this is  done  by  in‐
45       cluding the KDEInstallDirs module.
46
47       This section can be disabled by setting KDE_SKIP_RPATH_SETTINGS to TRUE
48       before including this module.
49
50   Testing
51       Testing is enabled by default, and an option  (BUILD_TESTING)  is  pro‐
52       vided  for users to control this. See the CTest module documentation in
53       the CMake manual for more details.
54
55       This section can be disabled by setting KDE_SKIP_TEST_SETTINGS to  TRUE
56       before including this module.
57
58   Build Settings
59       Various  CMake build defaults are altered, such as searching source and
60       build directories for includes first, enabling automoc by default.
61
62       When find_package(ECM 5.38) or higher is called, this  also  selects  a
63       layout  for  the  build  dir that helps running executables without in‐
64       stalling: all executables are built into a toplevel “bin”  dir,  making
65       it  possible  to  find helper binaries, and to find uninstalled plugins
66       (provided that you use kcoreaddons_add_plugin or set LIBRARY_OUTPUT_DI‐
67       RECTORY                 as                 documented                on
68       https://community.kde.org/Guidelines_and_HOWTOs/Making_apps_run_uninstalled).
69
70       This section can be disabled by setting KDE_SKIP_BUILD_SETTINGS to TRUE
71       before including this module.
72
73       This section also provides an “uninstall” target that can be  individu‐
74       ally  disabled  by setting KDE_SKIP_UNINSTALL_TARGET to TRUE before in‐
75       cluding this module.
76
77       By default on OS X, X11 and XCB related detections are  disabled.  How‐
78       ever  if  the need would arise to use these technologies, the detection
79       can be enabled by setting APPLE_FORCE_X11 to ON.
80
81       A warning is printed for the developer to know that  the  detection  is
82       disabled on OS X.  This message can be turned off by setting APPLE_SUP‐
83       PRESS_X11_WARNING to ON.
84
85       Since pre-1.0.0.
86
87       ENABLE_CLAZY option is added (OFF by default) when clang is being used.
88       Turning  this  option on will force clang to load the clazy plugins for
89       richer warnings on Qt-related code.
90
91       If  clang  is  not  being  used,  this  won’t  have  an  effect.    See
92       https://commits.kde.org/clazy?path=README.md
93
94       Since 5.17.0
95
96       • Uninstall target functionality since 1.7.0.
97
98APPLE_FORCE_X11 option since 5.14.0 (detecting X11 was previously the
99         default behavior)
100
101APPLE_SUPPRESS_X11_WARNING option since 5.14.0
102
103       • CMAKE_AUTORCC enabled by default when supported  by  cmake  (>=  3.0)
104         since 5.62.0
105
106   Translations
107       A  fetch-translations target will be set up that will download transla‐
108       tions for projects using l10n.kde.org.
109
110       KDE_L10N_BRANCH will be responsible for choosing which l10n  branch  to
111       use for the translations.
112
113       KDE_L10N_AUTO_TRANSLATIONS  (OFF  by  default)  will  indicate  whether
114       translations should be downloaded when building the project.
115
116       Since 5.34.0
117
118       KDE_L10N_SYNC_TRANSLATIONS (OFF by default) will download the  transla‐
119       tions at configuration time instead of build time.
120
121       Since 5.50.0
122
123   KDEClangFormat
124       This  module provides a functionality to format the source code of your
125       repository according to a predefined KDE clang-format file.
126
127       This module provides the following function:
128
129          kde_clang_format(<files>)
130
131       Using this function will create a clang-format target that will  format
132       all <files> passed to the function with the predefined KDE clang-format
133       style.  To format the files you have to invoke  the  target  with  make
134       clang-format  or  ninja clang-format.  Once the project is formatted it
135       is recommended to enforce the formatting using a pre-commit hook,  this
136       can be done using KDEGitCommitHooks.
137
138       The .clang-format file from ECM will be copied to the source directory.
139       This file should not be added to version control. It is recommended  to
140       add it to the .gitignore file: /.clang-format.
141
142       Since  5.79: If the source folder already contains a .clang-format file
143       it is not overwritten.  Since version 5.80 this function is  called  by
144       default  in  KDEFrameworkCompilerSettings. If directories should be ex‐
145       cluded from the formatting a .clang-format  file  with  “DisableFormat:
146       true” and “SortIncludes: false” should be created.
147
148       Example usage:
149
150          include(KDEClangFormat)
151          file(GLOB_RECURSE ALL_CLANG_FORMAT_SOURCE_FILES *.cpp *.h)
152          kde_clang_format(${ALL_CLANG_FORMAT_SOURCE_FILES})
153
154       To  exclude directories from the formatting add a .clang-format file in
155       the directory with the following contents:
156
157          DisableFormat: true
158          SortIncludes: false
159
160       Since 5.64
161
162   KDECompilerSettings
163       Set useful compile and link flags for C++ (and C) code.
164
165       Enables many more warnings than the default, and  sets  stricter  modes
166       for  some  compiler  features.   By  default,  exceptions are disabled;
167       kde_target_enable_exceptions() can be used to re-enable them for a spe‐
168       cific target.
169
170       NB:  it  is recommended to include this module with the NO_POLICY_SCOPE
171       flag, otherwise you may get spurious warnings  with  some  versions  of
172       CMake.
173
174       Since 5.85 newer settings are controlled by a variable KDE_COMPILERSET‐
175       TINGS_LEVEL, taking an ECM version as value. That version  can  not  be
176       greater  than the minimum required ECM version.  The settings which are
177       default at that version will then be used, but  can  be  overridden  by
178       more  fine-grained  controls  (see respective settings).  This variable
179       needs to be set before including this module, otherwise defaults to the
180       minimum required ECM version.
181
182   Modern code
183       The following CMake C standard default variables are set:
184
185       For KDE_COMPILERSETTINGS_LEVEL >= 5.85:
186
187CMAKE_C_STANDARD: 99
188
189CMAKE_C_STANDARD_REQUIRED: TRUE
190
191CMAKE_C_EXTENSIONS: OFF
192
193       Otherwise:
194
195CMAKE_C_STANDARD: 90
196
197CMAKE_C_STANDARD_REQUIRED: not modified
198
199CMAKE_C_EXTENSIONS: not modified
200
201       If  the  variable  CMAKE_C_STANDARD  is already set when including this
202       module, none of the above variables will be modified.
203
204       The following CMake C++ standard default variables are set:
205
206       For KDE_COMPILERSETTINGS_LEVEL >= 5.85:
207
208CMAKE_CXX_STANDARD: 17
209
210CMAKE_CXX_STANDARD_REQUIRED: TRUE
211
212CMAKE_CXX_EXTENSIONS: OFF
213
214       Otherwise:
215
216CMAKE_CXX_STANDARD: 11
217
218CMAKE_CXX_STANDARD_REQUIRED: TRUE
219
220CMAKE_CXX_EXTENSIONS: not modified.
221
222       If the variable CMAKE_CXX_STANDARD is already set when  including  this
223       module, none of the above variables will be modified.
224
225       The following C++ compiler flags are set:
226
227-pedantic (GNU and Clang compilers, since 5.85)
228
229         Can  be  disabled  by  setting KDE_SKIP_PEDANTIC_WARNINGS_SETTINGS to
230         TRUE before including this module (default is FALSE for KDE_COMPILER‐
231         SETTINGS_LEVEL >= 5.85, TRUE otherwise).
232
233-Wmissing-include-dirs (GNU compilers, since 5.85)
234
235         Can   be   disabled  by  setting  KDE_SKIP_MISSING_INCLUDE_DIRS_WARN‐
236         INGS_SETTINGS to TRUE before including this module (default is  FALSE
237         for KDE_COMPILERSETTINGS_LEVEL >= 5.85, TRUE otherwise).
238
239-Wzero-as-null-pointer-constant (GNU and Clang compilers, since 5.85)
240
241         Can be disabled by setting KDE_SKIP_NULLPTR_WARNINGS_SETTINGS to TRUE
242         before including this module (default is FALSE  for  KDE_COMPILERSET‐
243         TINGS_LEVEL >= 5.85, TRUE otherwise).
244
245       • Qt related preprocessor definitions (since 5.85.0):
246
247-DQT_NO_CAST_TO_ASCII
248
249-DQT_NO_CAST_FROM_ASCII
250
251-DQT_NO_URL_CAST_FROM_STRING
252
253-DQT_NO_CAST_FROM_BYTEARRAY
254
255-DQT_USE_QSTRINGBUILDER
256
257-DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT
258
259-DQT_NO_KEYWORDS
260
261-DQT_NO_FOREACH
262
263-DQT_STRICT_ITERATORS
264
265           Strict iterators are not enabled on Windows, because they lead to a
266           link error when application code iterates  over  a  QVector<QPoint>
267           for  instance,  unless  Qt itself was also built with strict itera‐
268           tors.  See example at https://bugreports.qt.io/browse/AUTOSUITE-946
269
270         Can be controlled by setting  KDE_QT_MODERNCODE_DEFINITIONS_LEVEL  to
271         the version of ECM where the wanted set of definitions has been added
272         before including this module (default is KDE_COMPILERSETTINGS_LEVEL).
273         To  disable  individual  definitions instead use remove_definitions()
274         directly after including this module.
275
276   Functions
277       This module provides the following functions:
278
279          kde_source_files_enable_exceptions([file1 [file2 [...]]])
280
281       Enables exceptions for specific source files.  This should not be  used
282       on source files in a language other than C++.
283
284          kde_target_enable_exceptions(target <INTERFACE|PUBLIC|PRIVATE>)
285
286       Enables exceptions for a specific target.  This should not be used on a
287       target that has source files in a language other than C++.
288
289          kde_enable_exceptions()
290
291       Enables exceptions for C++ source files compiled for the CMakeLists.txt
292       file in the current directory and all subdirectories.
293
294   Variables
295       Inclusion of this module defines the following variables:
296
297       ENABLE_BSYMBOLICFUNCTIONS
298              indicates  whether we make use of -Bsymbolic-functions for link‐
299              ing.  It ensures libraries bind global function  references  lo‐
300              cally rather than at runtime.  This option only has an effect on
301              ELF-based systems.
302
303              The option is disabled by default except  when  using  KDEFrame‐
304              workCompilerSettings.cmake  where it’s enabled. Projects can en‐
305              able it by calling set(ENABLE_BSYMBOLICFUNCTIONS ON) or  passing
306              -DENABLE BSYMBOLICFUNCTIONS=ON when configuring the build direc‐
307              tory.
308
309              Since 5.85
310
311       Example usages:
312
313          # needing some macro/feature only available with ECM 5.80.0
314          find_package(ECM 5.80.0 NO_MODULE)
315
316          # requiring ECM 5.80.0 above will default KDE_COMPILERSETTINGS_LEVEL also to 5.80.0,
317          # thus not activate any newer settings
318          include(KDECompilerSettings NO_POLICY_SCOPE)
319
320          # needing some macro/feature only available with ECM 5.87.0
321          find_package(ECM 5.87.0 NO_MODULE)
322
323          # project uses settings default as of KDECompilerSettings in ECM 5.85.0
324          set(KDE_COMPILERSETTINGS_LEVEL 5.85.0)
325          include(KDECompilerSettings NO_POLICY_SCOPE)
326
327          # needing some macro/feature only available with ECM 5.87.0
328          find_package(ECM 5.87.0 NO_MODULE)
329
330          # project mainly uses settings default as of KDECompilerSettings in ECM 5.85.0
331          # with some small twisting
332          set(KDE_COMPILERSETTINGS_LEVEL 5.85.0)
333          # not ready yet for pedantic compilers
334          set(KDE_SKIP_PEDANTIC_WARNINGS_SETTINGS TRUE)
335          # avoid any Qt definitions
336          set(KDE_QT_MODERNCODE_DEFINITIONS_LEVEL 5.84.0)
337          include(KDECompilerSettings NO_POLICY_SCOPE)
338
339          # needing some macro/feature only available with ECM 5.85.0
340          find_package(ECM 5.85.0 NO_MODULE)
341
342          # requiring ECM 5.85.0 above will default KDE_COMPILERSETTINGS_LEVEL also to 5.85.0,
343          # which again defaults KDE_QT_MODERNCODE_DEFINITIONS_LEVEL also to 5.85.0
344          include(KDECompilerSettings NO_POLICY_SCOPE)
345          # project is fine with almost all added Qt definitions as of 5.85.0, but not these ones:
346          remove_definitions(
347              -DQT_NO_KEYWORDS
348              -DQT_NO_FOREACH
349          )
350
351       Since pre-1.0.0.
352
353   KDEFrameworkCompilerSettings
354       Set stricter compile and link flags for KDE Frameworks modules.
355
356       WARNING:
357          Do not use this module for software which is not part of  KDE-Frame‐
358          works.   There  is  no guarantee for backward-compatibility in newer
359          versions.
360
361       The KDECompilerSettings module is included and,  in  addition,  various
362       defines that affect the Qt libraries are set to enforce certain conven‐
363       tions.
364
365       For example, constructions like QString(“foo”) are prohibited,  instead
366       forcing the use of QLatin1String or QStringLiteral, and some Qt-defined
367       keywords like signals and slots will not be defined.
368
369       NB: it is recommended to include this module with  the  NO_POLICY_SCOPE
370       flag,  otherwise  you  may  get spurious warnings with some versions of
371       CMake.
372
373       Since pre-1.0.0.
374
375   KDEGitCommitHooks
376       This module provides a functionality to enforce formatting  or  in  the
377       future other QS checks.
378
379       This module provides the following function:
380
381          kde_configure_pre_commit_hook(
382             CHECKS <check1> [<check2> [...]]
383          )
384
385       This  function  will  create  a  pre-commit hook which contains all the
386       given checks.
387
388       Checks:
389
390CLANG_FORMAT With this check enabled the git clang-format  tool  will
391         be  used  to make sure that the changed parts are properly formatted.
392         In case the changes are not properly formatted an error message  with
393         the command to preview the formatting changes and to format the files
394         in place  will  be  displayed.  This  tool  will  reuse  the  exsting
395         .clang-format  file,  in case you want to use the one provided by ECM
396         you can include include(KDEClangFormat) which will copy the  file  to
397         the source dir. It is also recommended to reformat the entire project
398         before enforcing the formatting using this commit hook.
399
400       Example usage:
401
402          include(KDEGitCommitHooks)
403          kde_configure_git_pre_commit_hook(CHECKS CLANG_FORMAT)
404
405       Since 5.79
406
407   KDEInstallDirs
408       Define KDE standard installation directories.
409
410       Note that none of the variables defined by this module provide any  in‐
411       formation about the location of already-installed KDE software.
412
413       Also  sets  CMAKE_INSTALL_PREFIX to the installation prefix of ECM, un‐
414       less that variable has been already explicitly set  by  something  else
415       (since 5.61 and with CMake >= 3.7).
416
417       Inclusion of this module defines the following variables:
418
419       KDE_INSTALL_<dir>
420              destination for files of a given type
421
422       KDE_INSTALL_FULL_<dir>
423              corresponding absolute path
424
425       where  <dir>  is one of (default values in parentheses and alternative,
426       deprecated variable name in square brackets):
427
428       BUNDLEDIR
429              application bundles (/Applications/KDE) [BUNDLE_INSTALL_DIR]
430
431       EXECROOTDIR
432              executables and libraries (<empty>) [EXEC_INSTALL_PREFIX]
433
434       BINDIR user executables (EXECROOTDIR/bin) [BIN_INSTALL_DIR]
435
436       SBINDIR
437              system admin executables (EXECROOTDIR/sbin) [SBIN_INSTALL_DIR]
438
439       LIBDIR object code libraries (EXECROOTDIR/lib, EXECROOTDIR/lib64 or EX‐
440              ECROOTDIR/lib/<multiarch-tuple on Debian) [LIB_INSTALL_DIR]
441
442       LIBEXECDIR
443              executables  for  internal use by programs and libraries (BINDIR
444              on Windows, LIBDIR/libexec otherwise) [LIBEXEC_INSTALL_DIR]
445
446       CMAKEPACKAGEDIR
447              CMake packages, including config files (LIBDIR/cmake) [CMAKECON‐
448              FIG_INSTALL_PREFIX]
449
450       QTPLUGINDIR
451              Qt  plugins  (LIBDIR/plugins  or qmake-qt5’s QT_INSTALL_PLUGINS)
452              [QT_PLUGIN_INSTALL_DIR]
453
454       PLUGINDIR
455              Plugins (QTPLUGINDIR) [PLUGIN_INSTALL_DIR]
456
457       QTQUICKIMPORTSDIR
458              QtQuick1  imports  (QTPLUGINDIR/imports  or  qmake-qt5’s  QT_IN‐
459              STALL_IMPORTS) [IMPORTS_INSTALL_DIR]
460
461       QMLDIR QtQuick2  imports  (LIBDIR/qml  or  qmake-qt5’s  QT_INSTALL_QML)
462              [QML_INSTALL_DIR]
463
464       INCLUDEDIR
465              C and C++ header files (include) [INCLUDE_INSTALL_DIR]
466
467       LOCALSTATEDIR
468              modifiable single-machine data (var)
469
470       SHAREDSTATEDIR
471              modifiable architecture-independent data (com)
472
473       DATAROOTDIR
474              read-only architecture-independent data root (share)  [SHARE_IN‐
475              STALL_PREFIX]
476
477       DATADIR
478              read-only  architecture-independent data (DATAROOTDIR) [DATA_IN‐
479              STALL_DIR]
480
481       DOCBUNDLEDIR
482              documentation  bundles  generated  using  kdoctools   (DATAROOT‐
483              DIR/doc/HTML) [HTML_INSTALL_DIR]
484
485       KCFGDIR
486              kconfig  description  files  (DATAROOTDIR/config.kcfg) [KCFG_IN‐
487              STALL_DIR]
488
489       KCONFUPDATEDIR
490              kconf_update   scripts   (DATAROOTDIR/kconf_update)   [KCONF_UP‐
491              DATE_INSTALL_DIR]
492
493       KSERVICES5DIR
494              services  for  KDE  Frameworks  5 (DATAROOTDIR/kservices5) [SER‐
495              VICES_INSTALL_DIR]
496
497       KSERVICETYPES5DIR
498              service types for KDE Frameworks 5  (DATAROOTDIR/kservicetypes5)
499              [SERVICETYPES_INSTALL_DIR]
500
501       KXMLGUI5DIR
502              knotify  description  files  (DATAROOTDIR/kxmlgui5) [KXMLGUI_IN‐
503              STALL_DIR]
504
505       KTEMPLATESDIR
506              Kapptemplate and Kdevelop templates (kdevappwizard/templates)
507
508       KNOTIFY5RCDIR
509              knotify description files (DATAROOTDIR/knotifications5)  [KNOTI‐
510              FYRC_INSTALL_DIR]
511
512       ICONDIR
513              icons (DATAROOTDIR/icons) [ICON_INSTALL_DIR]
514
515       LOCALEDIR
516              knotify   description   files  (DATAROOTDIR/locale)  [LOCALE_IN‐
517              STALL_DIR]
518
519       SOUNDDIR
520              sound files (DATAROOTDIR/sounds) [SOUND_INSTALL_DIR]
521
522       TEMPLATEDIR
523              templates (DATAROOTDIR/templates) [TEMPLATES_INSTALL_DIR]
524
525       WALLPAPERDIR
526              desktop wallpaper images (DATAROOTDIR/wallpapers) [WALLPAPER_IN‐
527              STALL_DIR]
528
529       APPDIR application   desktop   files  (DATAROOTDIR/applications)  Since
530              1.1.0.  [XDG_APPS_INSTALL_DIR]
531
532       DESKTOPDIR
533              desktop directories  (DATAROOTDIR/desktop-directories)  [XDG_DI‐
534              RECTORY_INSTALL_DIR]
535
536       MIMEDIR
537              mime description files (DATAROOTDIR/mime/packages) [XDG_MIME_IN‐
538              STALL_DIR]
539
540       METAINFODIR
541              AppStream component metadata files (DATAROOTDIR/metainfo)
542
543       QTQCHDIR
544              documentation bundles in QCH format for  Qt-extending  libraries
545              (DATAROOTDIR/doc/qch   or   qmake-qt5’s  QT_INSTALL_DOCS)  Since
546              5.36.0.
547
548       QCHDIR documentation bundles in QCH format (DATAROOTDIR/doc/qch)  Since
549              5.36.0.
550
551       MANDIR man documentation (DATAROOTDIR/man) [MAN_INSTALL_DIR]
552
553       INFODIR
554              info documentation (DATAROOTDIR/info)
555
556       DBUSDIR
557              D-Bus (DATAROOTDIR/dbus-1)
558
559       DBUSINTERFACEDIR
560              D-Bus   interfaces   (DBUSDIR/interfaces)   [DBUS_INTERFACES_IN‐
561              STALL_DIR]
562
563       DBUSSERVICEDIR
564              D-Bus  session  services  (DBUSDIR/services)  [DBUS_SERVICES_IN‐
565              STALL_DIR]
566
567       DBUSSYSTEMSERVICEDIR
568              D-Bus   system   services  (DBUSDIR/system-services)  [DBUS_SYS‐
569              TEM_SERVICES_INSTALL_DIR]
570
571       SYSCONFDIR
572              read-only  single-machine  data  (etc,  or  /etc  if   CMAKE_IN‐
573              STALL_PREFIX is /usr) [SYSCONF_INSTALL_DIR]
574
575       CONFDIR
576              application  configuration  files  (SYSCONFDIR/xdg)  [CONFIG_IN‐
577              STALL_DIR]
578
579       AUTOSTARTDIR
580              autostart files (CONFDIR/autostart) [AUTOSTART_INSTALL_DIR]
581
582       LOGGINGCATEGORIESDIR
583              Qt logging categories files directory (DATAROOTDIR/qlogging-cat‐
584              egories5) Since 5.59.0
585
586       JARDIR Java AAR/JAR files for Android. Since 5.62.0
587
588       SYSTEMDUNITDIR
589              Systemd  Units  (lib/systemd)  [SYSTEMD_UNIT_INSTALL_DIR]. Since
590              5.65
591
592       SYSTEMDUSERUNITDIR
593              Systemd  User  Units  (lib/systemd/user)  [SYSTEMD_USER_UNIT_IN‐
594              STALL_DIR]. Since 5.65
595
596       If  KDE_INSTALL_USE_QT_SYS_PATHS  is  set to TRUE before including this
597       module, the default values for some variables are instead queried  from
598       Qt5’s qmake (where mentioned in the parentheses above).  If not set, it
599       will default to TRUE if Qt5’s qmake is found and it’s QT_INSTALL_PREFIX
600       is  the same as CMAKE_INSTALL_PREFIX, otherwise default to FALSE.  This
601       variable should NOT be set from within CMakeLists.txt files, instead is
602       intended  to be set manually when configuring a project which uses KDE‐
603       InstallDirs (e.g. by packagers).
604
605       If KDE_INSTALL_DIRS_NO_DEPRECATED is set to TRUE before including  this
606       module,  the deprecated variables (listed in the square brackets above)
607       are not defined.
608
609       In addition, for each KDE_INSTALL_* variable, an  equivalent  CMAKE_IN‐
610       STALL_*  variable  is defined. If KDE_INSTALL_DIRS_NO_DEPRECATED is set
611       to TRUE, only those variables  defined  by  the  GNUInstallDirs  module
612       (shipped  with  CMake) are defined.  If KDE_INSTALL_DIRS_NO_CMAKE_VARI‐
613       ABLES is set to TRUE, no variables with a CMAKE_ prefix will be defined
614       by  this  module (other than CMAKE_INSTALL_DEFAULT_COMPONENT_NAME - see
615       below).
616
617       The KDE_INSTALL_<dir> variables (or their CMAKE_INSTALL_<dir> or depre‐
618       cated  counterparts)  may  be  passed to the DESTINATION options of in‐
619       stall() commands for the corresponding file type.  They are set in  the
620       CMake cache, and so the defaults above can be overridden by users.
621
622       Note that the KDE_INSTALL_<dir>, CMAKE_INSTALL_<dir> or deprecated form
623       of the variable can be changed using CMake command line variable  defi‐
624       nitions;  in  either  case, all forms of the variable will be affected.
625       The effect of passing multiple forms of the same variable on  the  com‐
626       mand line (such as KDE_INSTALL_BINDIR and CMAKE_INSTALL_BINDIR is unde‐
627       fined.
628
629       The variable KDE_INSTALL_TARGETS_DEFAULT_ARGS is  also  defined  (along
630       with the deprecated form INSTALL_TARGETS_DEFAULT_ARGS).  This should be
631       used when libraries or user-executable applications are  installed,  in
632       the following manner:
633
634          install(TARGETS mylib myapp ${KDE_INSTALL_TARGETS_DEFAULT_ARGS})
635
636       It MUST NOT be used for installing plugins, system admin executables or
637       executables only intended for use  internally  by  other  code.   Those
638       should   use   KDE_INSTALL_PLUGINDIR,  KDE_INSTALL_SBINDIR  or  KDE_IN‐
639       STALL_LIBEXECDIR respectively.
640
641       Additionally,  CMAKE_INSTALL_DEFAULT_COMPONENT_NAME  will  be  set   to
642       ${PROJECT_NAME} to provide a sensible default for this CMake option.
643
644       Note  that mixing absolute and relative paths, particularly for BINDIR,
645       LIBDIR and INCLUDEDIR, can cause issues with  exported  targets.  Given
646       that  the  default  values for these are relative paths, relative paths
647       should be used on the command line when  possible  (eg:  use  -DKDE_IN‐
648       STALL_LIBDIR=lib64  instead  of  -DKDE_INSTALL_LIBDIR=/usr/lib/lib64 to
649       override the library directory).
650
651       Since pre-1.0.0.
652
653       NB: The variables starting KDE_INSTALL_ are available since 1.6.0,  un‐
654       less otherwise noted with the variable.
655
656       The   KDE_INSTALL_PREFIX_SCRIPT   option  will  install  a  ${CMAKE_IN‐
657       STALL_PREFIX}/prefix.sh file that allows to easily incorporate the nec‐
658       essary environment variables for the prefix into a process.
659
660   KDETemplateGenerator
661       Packages KApptemplate/KDevelop compatible application templates
662
663       This  module  provides  a functionality to package in a tarball and in‐
664       stall project templates compatible with the format used by KApptemplate
665       and  KDevelop.  Useful  for providing minimal examples for the usage of
666       the KDE Frameworks.
667
668       This module provides the following function:
669
670          kde_package_app_templates(TEMPLATES <template> [<template> [...]]
671                                    INSTALL_DIR <directory>)
672
673       INSTALL_DIR is the directory to install the template  package  to.   In
674       most  cases you will want to use the variable KDE_INSTALL_KTEMPLATESDIR
675       from KDEInstallDirs.
676
677       TEMPLATES lists subdirectories containing template  files;  each  <tem‐
678       plate>  directory will be packaged into a file named <template>.tar.bz2
679       and installed to the appropriate location.
680
681       The template is a minimal source tree of an application as if it was an
682       application  project  by itself, with names (file names or text inside)
683       the text files replaced by the following placeholders when needed:
684
685       %{PROJECTDIRNAME}
686              name of generated  project  base  folder  ex:  %{APPNAMELC}  for
687              KAppTemplate
688
689       %{APPNAME}
690              project name as entered by user ex: MyKApp
691
692       %{APPNAMELC}
693              project name in lower case ex: mykapp
694
695       %{APPNAMEUC}
696              project name in upper case ex: MYKAPP
697
698       %{CPP_TEMPLATE}
699              license header for cpp file
700
701       %{H_TEMPLATE}
702              license header for h file
703
704       %{AUTHOR}
705              author name ex: George Ignacious
706
707       %{EMAIL}
708              author email ex: foo@bar.org
709
710       %{VERSION}
711              project version ex: 0.1
712
713       Deprecated:
714
715       %{dest}
716              path  of  generated  project  base folder, used in .kdevtemplate
717              with the ShowFilesAfterGeneration entry KDevelop >=  5.1.1  sup‐
718              ports  relative  paths  with that entry, making this placeholder
719              obsolete
720
721       Multiple templates can be passed at once.
722
723       Since 5.18
724

SEE ALSO

726       ecm(7), ecm-modules(7), ecm-find-modules(7)
727
729       KDE Developers
730
731
732
733
7345.88                             Nov 08, 2021               ECM-KDE-MODULES(7)
Impressum