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

NAME

6       ecm-modules - ECM Modules Reference
7

INTRODUCTION

9       Extra  CMake Modules (ECM) provides various modules that provide useful
10       functions for CMake scripts. ECM actually provides three types of  mod‐
11       ules  that  can be used from CMake scripts: those that extend the func‐
12       tionality of the find_package command are documented  in  ecm-find-mod‐
13       ules(7);  those that provide standard settings for software produced by
14       the KDE community are documented in ecm-kde-modules(7).  The rest  pro‐
15       vide macros and functions for general use by CMake scripts and are doc‐
16       umented here.
17
18       To use these modules, you need to tell CMake to find the  ECM  package,
19       and  then  add  either  ${ECM_MODULE_PATH}  or ${ECM_MODULE_DIR} to the
20       CMAKE_MODULE_PATH variable:
21
22          find_package(ECM REQUIRED NO_MODULE)
23          set(CMAKE_MODULE_PATH ${ECM_MODULE_DIR})
24
25       Using ${ECM_MODULE_PATH} will also make the find modules and  KDE  mod‐
26       ules available.
27
28       Note   that   there   are   also   toolchain   modules,  documented  in
29       ecm-toolchains(7), but these are used by users  building  the  software
30       rather than developers writing CMake scripts.
31

ALL MODULES

33   CheckAtomic
34       Check  if  the  compiler  supports  std:atomic out of the box or if li‐
35       batomic is needed for atomic support. If it is needed libatomicis added
36       to  CMAKE_REQUIRED_LIBRARIES.  So after running CheckAtomic you can use
37       std:atomic.
38
39       Since 5.75.0.
40
41   ECMAddAppIcon
42       Add icons to executable files and packages.
43
44          ecm_add_app_icon(<sources_var_name(|target (since 5.83))>
45                           ICONS <icon> [<icon> [...]]
46                           [SIDEBAR_ICONS <icon> [<icon> [...]] # Since 5.49
47                           [OUTFILE_BASENAME <name>]) # Since 5.49
48                           )
49
50       The given icons, whose names must match the pattern:
51
52          <size>-<other_text>.png
53
54       will be added as platform-specific application icons  to  the  variable
55       named  <sources_var_name>  or, if the first argument is a target (since
56       5.83), to the SOURCES property of <target>.  Any target must be created
57       with add_executable() and not be an alias.
58
59       Other  icon files are ignored but on Mac SVG files can be supported and
60       it is thus possible to mix those with png files in a single macro call.
61
62       The platforms currently supported are Windows and Mac OS X, on all oth‐
63       ers the call has no effect and is ignored.
64
65       <size>  is a numeric pixel size (typically 16, 32, 48, 64, 128 or 256).
66       <other_text> can be any other text. See the platform  notes  below  for
67       any recommendations about icon sizes.
68
69       SIDEBAR_ICONS  can  be used to add Mac OS X sidebar icons to the gener‐
70       ated iconset. They are used when a folder monitored by the  application
71       is dragged into Finder’s sidebar. Since 5.49.
72
73       OUTFILE_BASENAME will be used as the basename for the icon file. If you
74       specify it, the icon file will be called <OUTFILE_BASENAME>.icns on Mac
75       OS X and <OUTFILE_BASENAME>.ico on Windows. If you don’t specify it, it
76       defaults to <sources_var_name>.<ext>. Since 5.49.
77
78       Windows notes
79
80              • Icons are compiled into the executable using a resource file.
81
82              • Icons may not show up in Windows Explorer  if  the  executable
83                target does not have the WIN32_EXECUTABLE property set.
84
85              • Icotool (see FindIcoTool) is required.
86
87              • Supported sizes: 16, 24, 32, 48, 64, 128, 256, 512 and 1024.
88
89       Mac OS X notes
90
91              • The  executable  target  must  have the MACOSX_BUNDLE property
92                set.
93
94              • Icons are added to the bundle.
95
96              • If the ksvg2icns tool from KIconThemes is available, .svg  and
97                .svgz files are accepted; the first that is converted success‐
98                fully to .icns will provide the application  icon.  SVG  files
99                are ignored otherwise.
100
101              • The  tool  iconutil (provided by Apple) is required for bitmap
102                icons.
103
104              • Supported sizes: 16, 32, 64, 128, 256 (and 512, 1024 after  OS
105                X 10.9).
106
107              • At least a 128x128px (or an SVG) icon is required.
108
109              • Larger  sizes are automatically used to substitute for smaller
110                sizes on “Retina” (high-resolution) displays. For  example,  a
111                32px  icon,  if provided, will be used as a 32px icon on stan‐
112                dard-resolution displays, and as a 16px-equivalent icon  (with
113                an  “@2x”  tag)  on  high-resolution displays. That is why you
114                should provide 64px and 1024px icons  although  they  are  not
115                supported  anymore  directly.  Instead  they  will  be used as
116                32px@2x and 512px@2x. If an SVG icon  is  provided,  ksvg2icns
117                will  be  used internally to automatically generate all appro‐
118                priate sizes, including the high-resolution ones.
119
120              • This function sets the MACOSX_BUNDLE_ICON_FILE variable to the
121                name  of  the  generated icns file, so that it will be used as
122                the MACOSX_BUNDLE_ICON_FILE  target  property  when  you  call
123                add_executable.
124
125              • Sidebar icons should typically provided in 16, 32, 64, 128 and
126                256px.
127
128       Since 1.7.0.
129
130   ECMAddQch
131       This module provides the ecm_add_qch function for generating API  docu‐
132       mentation files in the QCH format, and the ecm_install_qch_export func‐
133       tion for generating and installing exported CMake targets for such gen‐
134       erated  QCH files to enable builds of other software with generation of
135       QCH files to create links into the given QCH files.
136
137          ecm_add_qch(<target_name>
138              NAME <name>
139              VERSION <version>
140              QCH_INSTALL_DESTINATION <qchfile_install_path>
141              TAGFILE_INSTALL_DESTINATION <tagsfile_install_path>
142              [COMPONENT <component>]
143              [BASE_NAME <basename>]
144              [SOURCE_DIRS <dir> [<dir2> [...]]]
145              [SOURCES <file> [<file2> [...]]]
146              |MD_MAINPAGE <md_file>]
147              [INCLUDE_DIRS <incdir> [<incdir2> [...]]]
148              [IMAGE_DIRS <idir> [<idir2> [...]]]
149              [EXAMPLE_DIRS <edir> [<edir2> [...]]]
150              [ORG_DOMAIN <domain>]
151              [NAMESPACE <namespace>]
152              [LINK_QCHS <qch> [<qch2> [...]]]
153              [PREDEFINED_MACROS <macro[=content]> [<macro2[=content]> [...]]]
154              [BLANK_MACROS <macro> [<macro2> [...]]]
155              [CONFIG_TEMPLATE <configtemplate_file>]
156              [VERBOSE]
157          )
158
159       This macro adds a target called <target_name> for the  creation  of  an
160       API  documentation manual in the QCH format from the given sources.  It
161       currently uses doxygen, future versions  might  optionally  also  allow
162       other  tools.   Next  to the QCH file the target will generate a corre‐
163       sponding doxygen tag file, which enables creating links from other doc‐
164       umentation into the generated QCH file.
165
166       It  is recommended to make the use of this macro optional, by depending
167       the call to ecm_add_qch on a CMake option being set, with a  name  like
168       BUILD_QCH  and being TRUE by default. This will allow the developers to
169       saves resources on normal source development build  cycles  by  setting
170       this option to FALSE.
171
172       The  macro  will  set  the target properties DOXYGEN_TAGFILE, QHP_NAME‐
173       SPACE, QHP_NAMESPACE_VERSIONED, QHP_VIRTUALFOLDER and LINK_QCHS to  the
174       respective  values,  to allow other code access to them, e.g. the macro
175       ecm_install_qch_export.  To enable the use of the target  <target_name>
176       as  item  for  LINK_QCHS  in  further  ecm_add_qch calls in the current
177       build, additionally a target  property  DOXYGEN_TAGFILE_BUILD  is  set,
178       with the path of the created doxygen tag file in the build dir.  If ex‐
179       isting, ecm_add_qch will use this property instead  of  DOXYGEN_TAGFILE
180       for access to the tags file.
181
182       NAME specifies the name for the generated documentation.
183
184       VERSION  specifies  the version of the library for which the documenta‐
185       tion is created.
186
187       BASE_NAME specifies the base name for the generated files.  The default
188       basename is <name>.
189
190       SOURCE_DIRS  specifies  the  dirs (incl. subdirs) with the source files
191       for which the API documentation should be generated.  Dirs can be rela‐
192       tive  to  the current source dir. Dependencies to the files in the dirs
193       are not tracked currently, other than with the SOURCES argument. So  do
194       not  use for sources generated during the build.  Needs to be used when
195       SOURCES or CONFIG_TEMPLATE are not used.
196
197       SOURCES specifies the source files  for  which  the  API  documentation
198       should  be generated.  Needs to be used when SOURCE_DIRS or CONFIG_TEM‐
199       PLATE are not used.
200
201       MD_MAINPAGE specifies a file in Markdown format that should be used  as
202       main  page.  This  page  will overrule any \mainpage command in the in‐
203       cluded sources.
204
205       INCLUDE_DIRS specifies the dirs which should be searched  for  included
206       headers. Dirs can be relative to the current source dir. Since 5.63.
207
208       IMAGE_DIRS specifies the dirs which contain images that are included in
209       the documentation. Dirs can be relative to the current source dir.
210
211       EXAMPLE_DIRS specifies the dirs which contain  examples  that  are  in‐
212       cluded in the documentation. Dirs can be relative to the current source
213       dir.
214
215       QCH_INSTALL_DESTINATION specifies where the generated QCH file will  be
216       installed.
217
218       TAGFILE_INSTALL_DESTINATION specifies where the generated tag file will
219       be installed.
220
221       COMPONENT specifies the installation component name with which the  in‐
222       stall rules for the generated QCH file and tag file are associated.
223
224       NAMESPACE can be used to set a custom namespace <namespace> of the gen‐
225       erated QCH file. The namepspace is used as the unique id by QHelpEngine
226       (cmp.   https://doc.qt.io/qt-5/qthelpproject.html#namespace).   The de‐
227       fault namespace is <domain>.<name>.  Needs to be used  when  ORG_DOMAIN
228       is not used.
229
230       ORG_DOMAIN can be used to define the organization domain prefix for the
231       default namespace of the generated QCH file.  Needs  to  be  used  when
232       NAMESPACE is not used.
233
234       LINK_QCHS  specifies  a  list of other QCH targets which should be used
235       for creating references to API documentation of code  in  external  li‐
236       braries.  For each target <qch> in the list these target properties are
237       expected to be defined: DOXYGEN_TAGFILE, QHP_NAMESPACE and QHP_VIRTUAL‐
238       FOLDER.   If  any of these is not existing, <qch> will be ignored.  Use
239       the macro ecm_install_qch_export for  exporting  a  target  with  these
240       properties  with  the  CMake config of a library.  Any target <qch> can
241       also be one created before in the same buildsystem by another  call  of
242       ecm_add_qch.
243
244       PREDEFINED_MACROS specifies a list of C/C++ macros which should be han‐
245       dled as given by the API dox generation tool.  Examples are macros only
246       defined  in generated files, so whose definition might be not available
247       to the tool.
248
249       BLANK_MACROS specifies a list of C/C++ macro names which should be  ig‐
250       nored  by the API dox generation tool and handled as if they resolve to
251       empty strings.  Examples are export macros only  defined  in  generated
252       files, so whose definition might be not available to the tool.
253
254       CONFIG_TEMPLATE  specifies  a custom cmake template file for the config
255       file that is created to control the execution of the API dox generation
256       tool.   The  following CMake variables need to be used: - ECM_QCH_DOXY‐
257       GEN_QHELPGENERATOR_EXECUTABLE - ECM_QCH_DOXYGEN_FILEPATH, ECM_QCH_DOXY‐
258       GEN_TAGFILE  The following CMake variables can be used: - ECM_QCH_DOXY‐
259       GEN_PROJECTNAME - ECM_QCH_DOXYGEN_PROJECTVERSION - ECM_QCH_DOXYGEN_VIR‐
260       TUALFOLDER - ECM_QCH_DOXYGEN_FULLNAMESPACE - ECM_QCH_DOXYGEN_TAGFILES -
261       ECM_QCH_DOXYGEN_WARN_LOGFILE - ECM_QCH_DOXYGEN_QUIET There is no  guar‐
262       antue that the other CMake variables currently used in the default con‐
263       fig file template will also be present with the same semantics  in  fu‐
264       ture versions of this macro.
265
266       VERBOSE  tells the API dox generation tool to be more verbose about its
267       activity.
268
269       The default config file for the API dox generation  tool,  so  the  one
270       when not using CONFIG_TEMPLATE, allows code to handle the case of being
271       processed by the tool by defining the C/C++ preprocessor macro  K_DOXY‐
272       GEN when run (since v5.67.0). For backward-compatibility also the defi‐
273       nition DOXYGEN_SHOULD_SKIP_THIS is set, but its usage is deprecated.
274
275       Example usage:
276
277          ecm_add_qch(
278              MyLib_QCH
279              NAME MyLib
280              VERSION "0.42.0"
281              ORG_DOMAIN org.myorg
282              SOURCE_DIRS
283                  src
284              LINK_QCHS
285                  Qt5Core_QCH
286                  Qt5Xml_QCH
287                  Qt5Gui_QCH
288                  Qt5Widgets_QCH
289              BLANK_MACROS
290                  MyLib_EXPORT
291                  MyLib_DEPRECATED
292              TAGFILE_INSTALL_DESTINATION ${CMAKE_INSTALL_PREFIX}/share/docs/tags
293              QCH_INSTALL_DESTINATION ${CMAKE_INSTALL_PREFIX}/share/docs/qch
294              COMPONENT Devel
295          )
296
297       Example usage (with two QCH files, second linking first):
298
299          ecm_add_qch(
300              MyLib_QCH
301              NAME MyLib
302              VERSION ${MyLib_VERSION}
303              ORG_DOMAIN org.myorg
304              SOURCES ${MyLib_PUBLIC_HEADERS}
305              MD_MAINPAGE src/mylib/README.md
306              LINK_QCHS Qt5Core_QCH
307              TAGFILE_INSTALL_DESTINATION ${CMAKE_INSTALL_PREFIX}/share/docs/tags
308              QCH_INSTALL_DESTINATION ${CMAKE_INSTALL_PREFIX}/share/docs/qch
309              COMPONENT Devel
310          )
311          ecm_add_qch(
312              MyOtherLib_QCH
313              NAME MyOtherLib
314              VERSION ${MyOtherLib_VERSION}
315              ORG_DOMAIN org.myorg
316              SOURCES ${MyOtherLib_PUBLIC_HEADERS}
317              MD_MAINPAGE src/myotherlib/README.md
318              LINK_QCHS Qt5Core_QCH MyLib_QCH
319              TAGFILE_INSTALL_DESTINATION ${CMAKE_INSTALL_PREFIX}/share/docs/tags
320              QCH_INSTALL_DESTINATION ${CMAKE_INSTALL_PREFIX}/share/docs/qch
321              COMPONENT Devel
322          )
323
324          ecm_install_qch_export(
325              TARGETS [<name> [<name2> [...]]]
326              FILE <file>
327              DESTINATION <dest>
328              [COMPONENT <component>]
329          )
330
331       This macro creates and installs a CMake file <file> which  exports  the
332       given  QCH targets <name> etc., so they can be picked up by CMake-based
333       builds  of  other  software  that  also  generate  QCH   files   (using
334       ecm_add_qch) and which should include links to the QCH files created by
335       the given targets.  The installed CMake file <file> is expected  to  be
336       included  by the CMake config file created for the software the related
337       QCH files are documenting.
338
339       TARGETS specifies the QCH targets which should be exported. If a target
340       does  not  exist or does not have all needed properties, a warning will
341       be generated and the target skipped.  This behaviour  might  change  in
342       future versions to result in a fail instead.
343
344       FILE  specifies  the  name  of the created CMake file, typically with a
345       .cmake extension.
346
347       DESTINATION specifies the directory on disk to which the file  will  be
348       installed.  It  usually  is  the same as the one where the CMake config
349       files for this software are installed.
350
351       COMPONENT specifies the installation component name with which the  in‐
352       stall rule is associated.
353
354       Example usage:
355
356          ecm_install_qch_export(
357              TARGETS MyLib_QCH
358              FILE MyLibQCHTargets.cmake
359              DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/cmake/MyLib"
360              COMPONENT Devel
361          )
362
363       Since 5.36.0.
364
365   ECMAddQtDesignerPlugin
366       This module provides the ecm_add_qtdesignerplugin function for generat‐
367       ing Qt Designer plugins for custom widgets. Each of  those  widgets  is
368       described using a second function ecm_qtdesignerplugin_widget.
369
370          ecm_add_qtdesignerplugin(<target_name>
371              NAME <name>
372              WIDGETS <widgetid> [<widgetid2> [...]]
373              LINK_LIBRARIES <lib> [<lib2> [...]]
374              INSTALL_DESTINATION <install_path>
375              [OUTPUT_NAME <output_name>]
376              [DEFAULT_GROUP <group>]
377              [DEFAULT_HEADER_CASE <SAME_CASE|LOWER_CASE|UPPER_CASE>]
378              [DEFAULT_HEADER_EXTENSION <header_extension>]
379              [DEFAULT_ICON_DIR <icon_dir>]
380              [INCLUDE_FILES <include_file> [<include_file2> [...]]]
381              [SOURCES <src> [<src2> [...]]]
382              [COMPONENT <component>]
383          )
384
385       NAME  specifies the base name to use in the generated sources.  The de‐
386       fault is <target_name>.
387
388       WIDGETS specifies the widgets the plugin should  support.  Each  widget
389       has  to be defined before by a call of ecm_qtdesignerplugin_widget with
390       the respective <widgetid>, in a scope including the current call.
391
392       LINK_LIBRARIES specifies the libraries to link against. This will be at
393       least the library providing the widget class(es).
394
395       INSTALL_DESTINATION specifies where the generated plugin binary will be
396       installed.
397
398       OUTPUT_NAME specifies the name of the plugin  binary.  The  default  is
399       “<target_name>”.
400
401       DEFAULT_GROUP specifies the default group in Qt Designer where the wid‐
402       gets will be placed. The default is “Custom”.
403
404       DEFAULT_HEADER_CASE specifies how the name of  the  header  is  derived
405       from the widget class name.  The default is “LOWER_CASE”.
406
407       DEFAULT_HEADER_EXTENSION specifies what file name extension is used for
408       the header file derived from the class name.  The default is “h”.
409
410       DEFAULT_ICON_DIR specifies what file name extension  is  used  for  the
411       header file derived from the class name.  The default is “pics”.
412
413       INCLUDE_FILES  specifies  additional  include files to include with the
414       generated source file. This can be needed for custom code used in  ini‐
415       tializing or creating widgets.
416
417       SOURCES  specifies  additional  source  files to build the plugin from.
418       This can be needed to support custom code used in initializing or  cre‐
419       ating widgets.
420
421       COMPONENT  specifies the installation component name with which the in‐
422       stall rules for the generated plugin are associated.
423
424          ecm_qtdesignerplugin_widget(<widgetid>
425              [CLASS_NAME <class_name>]
426              [INCLUDE_FILE <include_file>]
427              [CONTAINER]
428              [ICON <iconfile>]
429              [TOOLTIP <tooltip>]
430              [WHATSTHIS <whatsthis>]
431              [GROUP <group>]
432              [CREATE_WIDGET_CODE_FROM_VARIABLE <create_widget_code_variable>]
433              [INITIALIZE_CODE_FROM_VARIABLE <initialize_code_variable]
434              [DOM_XML_FROM_VARIABLE <dom_xml_variable>]
435              [IMPL_CLASS_NAME <impl_class_name>]
436              [CONSTRUCTOR_ARGS_CODE <constructor_args_code>]
437              [CONSTRUCTOR_ARGS_CODE_FROM_VARIABLE <constructor_args_code_variable>]
438          )
439
440       CLASS_NAME specifies the name of  the  widget  class,  including  name‐
441       spaces.  The default is “<widgetid>”.
442
443       INCLUDE_FILE  specifies  the  include file to use for the class of this
444       widget. The default is derived from <class_name> as configured  by  the
445       DEFAULT_HEADER_*  options  of  ecm_add_qtdesignerplugin, also replacing
446       any namespace separators with “/”.
447
448       CONTAINER specifies, if set, that this widget is a container for  other
449       widgets.
450
451       ICON specifies the icon file to use as symbol for this widget.  The de‐
452       fault is “{lowercased <class_name>}.png” in the default  icons  dir  as
453       configured  by the DEFAULT_ICON_DIR option of ecm_add_qtdesignerplugin,
454       if such a file exists.
455
456       TOOLTIP specifies the tooltip text to use for this widget.  Default  is
457       “<class_name> Widget”.
458
459       WHATSTHIS  specifies  the What’s-This text to use for this widget.  De‐
460       faults to the tooltip.
461
462       GROUP specifies the group in Qt  Designer  where  the  widget  will  be
463       placed.   The  default is set as configured by the DEFAULT_GROUP option
464       of ecm_add_qtdesignerplugin.
465
466       CREATE_WIDGET_CODE_FROM_VARIABLE specifies the variable to get from the
467       C++  code  to  use as factory code to create an instance of the widget,
468       for the override of  QDesignerCustomWidgetInterface::createWidget(QWid‐
469       get*  parent).   The default is “return new <impl_class_name><construc‐
470       tor_args_code>;”.
471
472       INITIALIZE_CODE_FROM_VARIABLE specifies the variable to  get  from  the
473       C++  code  to  use  with  the  override  of QDesignerCustomWidgetInter‐
474       face::initialize(QDesignerFormEditorInterface* core).  The code has  to
475       use  the  present  class  member  m_initialized to track and update the
476       state. The default code simply sets m_initialized to true,  if  it  was
477       not before.
478
479       DOM_XML_FROM_VARIABLE  specifies the variable to get from the string to
480       use  with  the   optional   override   of   QDesignerCustomWidgetInter‐
481       face::domXml().  Default does not override.
482
483       IMPL_CLASS_NAME  specifies  the name of the widget class to use for the
484       widget instance with Qt Designer. The default is “<class_name>”.
485
486       CONSTRUCTOR_ARGS_CODE specifies the C++ code to use for the constructor
487       arguments  with  the  default of CREATE_WIDGET_CODE_FROM_VARIABLE. Note
488       that the parentheses are required. The default is “(parent)”.
489
490       CONSTRUCTOR_ARGS_CODE_FROM_VARIABLE specifies the variable to get  from
491       the  C++ code instead of passing it directly via CONSTRUCTOR_ARGS_CODE.
492       This can be needed if the code is more complex and  e.g.  includes  “;”
493       chars.
494
495       Example usage:
496
497          ecm_qtdesignerplugin_widget(FooWidget
498              TOOLTIP "Enables to browse foo."
499              GROUP "Views (Foo)"
500          )
501
502          set(BarWidget_CREATE_WIDGET_CODE
503          "
504              auto* widget = new BarWidget(parent);
505              widget->setBar("Example bar");
506              return widget;
507          ")
508
509          ecm_qtdesignerplugin_widget(BarWidget
510              TOOLTIP "Displays bars."
511              GROUP "Display (Foo)"
512              CREATE_WIDGET_CODE_FROM_VARIABLE BarWidget_CREATE_WIDGET_CODE
513          )
514
515          ecm_add_qtdesignerplugin(foowidgets
516              NAME FooWidgets
517              OUTPUT_NAME foo2widgets
518              WIDGETS
519                  FooWidget
520                  BarWidget
521              LINK_LIBRARIES
522                  Foo::Widgets
523              INSTALL_DESTINATION "${KDE_INSTALL_QTPLUGINDIR}/designer"
524              COMPONENT Devel
525          )
526
527       Since 5.62.0.
528
529   ECMAddTests
530       Convenience functions for adding tests.
531
532          ecm_add_tests(<sources> LINK_LIBRARIES <library> [<library> [...]]
533                                  [NAME_PREFIX <prefix>]
534                                  [GUI]
535                                  [TARGET_NAMES_VAR <target_names_var>]
536                                  [TEST_NAMES_VAR <test_names_var>])
537
538       A  convenience function for adding multiple tests, each consisting of a
539       single source file. For each file in <sources>,  an  executable  target
540       will  be  created (the name of which will be the basename of the source
541       file). This will be linked against the libraries  given  with  LINK_LI‐
542       BRARIES. Each executable will be added as a test with the same name.
543
544       If  NAME_PREFIX  is  given,  this  prefix will be prepended to the test
545       names, but not the target names. As  a  result,  it  will  not  prevent
546       clashes  between  tests  with  the  same name in different parts of the
547       project, but it can be used to give an indication of where to look  for
548       a failing test.
549
550       If  the  flag  GUI is passed the test binaries will be GUI executables,
551       otherwise the resulting binaries will be console applications  (regard‐
552       less of the value of CMAKE_WIN32_EXECUTABLE or CMAKE_MACOSX_BUNDLE). Be
553       aware that this changes the executable entry point on Windows (although
554       some frameworks, such as Qt, abstract this difference away).
555
556       The tests will be build with -DQT_FORCE_ASSERTS to enable assertions in
557       the test executable even for release builds.
558
559       The TARGET_NAMES_VAR and TEST_NAMES_VAR  arguments,  if  given,  should
560       specify  a  variable  name  to receive the list of generated target and
561       test names, respectively. This makes it convenient to apply  properties
562       to  them  as  a  whole,  for  example, using set_target_properties() or
563       set_tests_properties().
564
565       The  generated  target   executables   will   have   the   effects   of
566       ecm_mark_as_test() (from the ECMMarkAsTest module) applied to it.
567
568          ecm_add_test(<sources> LINK_LIBRARIES <library> [<library> [...]]
569                                 [TEST_NAME <name>]
570                                 [NAME_PREFIX <prefix>]
571                                 [GUI])
572
573       This is a single-test form of ecm_add_tests that allows multiple source
574       files to be used for a single test. If  using  multiple  source  files,
575       TEST_NAME must be given; this will be used for both the target and test
576       names (and, as with ecm_add_tests(), the NAME_PREFIX argument  will  be
577       prepended to the test name).
578
579       Since pre-1.0.0.
580
581   ECMCheckOutboundLicense
582       Assert that source file licenses are compatible with a desired outbound
583       license of a compiled binary artifact (e.g., library, plugin or  appli‐
584       cation).
585
586       This  module provides the ecm_check_outbound_license function that gen‐
587       erates unit tests for checking the compatibility of license statements.
588       The  license statements in all tested files are required to be added by
589       using the SPDX marker SPDX-License-Identifier.
590
591       During the CMake configuration of the project, a temporary license bill
592       of  materials  (BOM)  in  SPDX format is generated by calling the REUSE
593       tool (see <https://reuse.software>). That BOM  is  parsed  and  license
594       computations based on an internal compatibility matrix are performed.
595
596       Preconditions for using this module:
597
598              • All  tested  input  source  files  must  contain  the SPDX-Li‐
599                cense-Identifier tag.
600
601              • Python3 must be available.
602
603              • The  REUSE  tool  must  be  available,  which  generates   the
604                bill-of-materials  by  running reuse spdx on the tested direc‐
605                tory.
606
607       When this module is included, a SKIP_LICENSE_TESTS option is added (de‐
608       fault  OFF).  Turning  this  option  on skips the generation of license
609       tests, which might be convenient if licenses shall not be tested in all
610       build configurations.
611
612          ecm_check_outbound_license(LICENSES <outbound-licenses>
613                                     FILES <source-files>
614                                     [TEST_NAME <name>]
615                                     [WILL_FAIL])
616
617       This  method  adds  a custom unit test to ensure the specified outbound
618       license to be compatible with the specified license headers. Note  that
619       a  convenient  way  is to use the CMake GLOB argument of the FILE func‐
620       tion.
621
622       LICENSES
623              List of one or multiple outbound  license  regarding  which  the
624              compatibility  of  the source code files shall be tested..INDENT
625              7.0
626
627       Currently, the following values are supported (values are SPDX registry
628       identifiers):
629
630              • MIT
631
632              • BSD-2-Clause
633
634              • BSD-3-Clause
635
636              • LGPL-2.0-only
637
638              • LGPL-2.1-only
639
640              • LGPL-3.0-only
641
642              • GPL-2.0-only
643
644              • GPL-3.0-only
645
646       FILES: List  of source files that contain valid SPDX-License-Identifier
647              markers.  The paths can be relative to the CMake file that  gen‐
648              erates the test case or be absolute paths.
649
650       TEST_NAME
651              Optional  parameter  that defines the name of the generated test
652              case.  If no name is defined, the relative path to the test  di‐
653              rectory  with  appended license name is used. Every test has li‐
654              censecheck_ as prefix.
655
656       WILL_FAIL
657              Optional parameter that inverts the test result. This  parameter
658              is usually only used for tests of the module.
659
660Since 5.75.0
661
662   ECMConfiguredInstall
663       Takes a list of files, runs configure_file on each and installs the re‐
664       sultant configured files in the given location.
665
666       Any suffix of “.in” in the passed file names will be stripped from  the
667       file name at the installed location.
668
669          ecm_install_configured_files(
670              INPUT <file> [<file2> [...]]
671              DESTINATION <INSTALL_DIRECTORY>
672              [COPYONLY]
673              [ESCAPE_QUOTES]
674              [@ONLY]
675              [COMPONENT <component>])
676
677       Example usage:
678
679          ecm_install_configured_files(INPUT foo.txt.in DESTINATION ${KDE_INSTALL_DATADIR} @ONLY)
680
681       This  will install the file as foo.txt with any cmake variable replace‐
682       ments made into the data directory.
683
684       Since 5.73.0.
685
686   ECMCoverageOption
687       Allow users to easily enable GCov code coverage support.
688
689       Code coverage allows you to check how much of your codebase is  covered
690       by  your  tests.  This  module  makes it easy to build with support for
691       GCov.
692
693       When this module is included, a BUILD_COVERAGE option is added (default
694       OFF).  Turning  this  option on enables GCC’s coverage instrumentation,
695       and links against libgcov.
696
697       NOTE:
698          This will probably break the build if you are not using GCC.
699
700       Since 1.3.0.
701
702   ECMCreateQmFromPoFiles
703       WARNING:
704          This module is deprecated and will be removed by ECM 1.0. Use ECMPo‐
705          QmTools instead.
706
707       Generate QTranslator (.qm) catalogs from Gettext (.po) catalogs.
708
709          ecm_create_qm_from_po_files(PO_FILES <file1>... <fileN>
710                                      [CATALOG_NAME <catalog_name>]
711                                      [INSTALL_DESTINATION <install_destination>])
712
713       Creates  the  necessary  rules to compile .po files into .qm files, and
714       install them.
715
716       The .qm files  are  installed  in  <install_destination>/<lang>/LC_MES‐
717       SAGES,  where <install_destination> is the INSTALL_DESTINATION argument
718       and <lang> is extracted from the “Language” field inside the .po file.
719
720       INSTALL_DESTINATION defaults to ${LOCALE_INSTALL_DIR} if defined,  oth‐
721       erwise it uses ${CMAKE_INSTALL_LOCALEDIR} if that is defined, otherwise
722       it uses share/locale.
723
724       CATALOG_NAME defines the name of the installed .qm files. If  set,  .qm
725       files will be installed as <catalog_name>.qm. If not set .qm files will
726       be named after the name of their source .po file.
727
728       Setting the catalog name is useful when all .po files for a target  are
729       kept  in  a  single source directory. For example, the “mylib” probject
730       might keep all its translations in a “po” directory, like this:
731
732          po/
733              es.po
734              fr.po
735
736       Without setting CATALOG_NAME, those .po will be turned into .qm and in‐
737       stalled as:
738
739          share/locale/fr/LC_MESSAGES/fr.qm
740          share/locale/es/LC_MESSAGES/es.qm
741
742       If CATALOG_NAME is set to “mylib”, they will be installed as:
743
744          share/locale/fr/LC_MESSAGES/mylib.qm
745          share/locale/es/LC_MESSAGES/mylib.qm
746
747       Which is what the loader created by ecm_create_qm_loader() expects.
748
749       ecm_create_qm_from_po_files() creates a “translation” target. This tar‐
750       get builds all .po files into .qm files.
751
752          ecm_create_qm_loader(<source_files_var> <catalog_name>)
753
754       ecm_create_qm_loader() generates a C++ file which ensures  translations
755       are  automatically  loaded at startup. The path of the .cpp file is ap‐
756       pended to <source_files_var>.  Typical usage is like:
757
758          set(mylib_SRCS foo.cpp bar.cpp)
759          ecm_create_qm_loader(mylib_SRCS mylib)
760          add_library(mylib ${mylib_SRCS})
761
762       This generates a C++ file which loads “mylib.qm” at  startup,  assuming
763       it has been installed by ecm_create_qm_from_po_files(), and compiles it
764       into mylib.
765
766       Since pre-1.0.0.
767
768   ECMDeprecationSettings
769       This module provides the ecm_set_disabled_deprecation_versions function
770       setting the excluding deprecated API for Qt and KF projects.
771
772       This  method  expects  pairs of the identifier and deprecation version.
773       For the identifier  QT  this  functions  adds  the  definition  QT_DIS‐
774       ABLE_DEPRECATED_BEFORE  with the given version in a hexadecimal format.
775       Otherwise the name for the  definition  is  generated  using  ${IDENTI‐
776       FIER}_DISABLE_DEPRECATED_BEFORE_AND_AT,  following  the  naming  of the
777       generated code in ECMGenerateExportHeader.  The version for the defini‐
778       tion can be overwritten, by passing definition name and the deprecation
779       version as a CMake definition. This allows one to exclude  deprecations
780       without having to edit the CMakeLists.txt file.
781
782       This module provides the following function:
783
784          ecm_set_disabled_deprecation_versions(
785              [DISABLE_NEWER_WARNINGS] # since 5.96
786              [<identifier> <deprecation_version>]
787              [<identifier2> <deprecation_version2>]
788          )
789
790       DISABLE_NEWER_WARNINGS  disables additionally the compiler warnings for
791       API deprecated in newer versions of the same major version.
792
793       Example usage:
794
795          set(QT_MIN_VERSION "5.15.0")
796          set(KF5_MIN_VERSION "5.90")
797
798          ecm_set_disabled_deprecation_versions(
799            QT ${QT_MIN_VERSION}
800            KF ${KF5_MIN_VERSION}
801            KCOREADDONS 5.89.0 # In case we depend on deprecated KCoreAddons API
802          )
803
804       Since 5.91
805
806   ECMEnableSanitizers
807       Enable compiler sanitizer flags.
808
809       The following sanitizers are supported:
810
811       • Address Sanitizer
812
813       • Memory Sanitizer
814
815       • Thread Sanitizer
816
817       • Leak Sanitizer
818
819       • Undefined Behaviour Sanitizer
820
821       All of them are implemented in Clang, depending on  your  version,  and
822       there  is  an work in progress in GCC, where some of them are currently
823       implemented.
824
825       This module will check your current compiler version to see if it  sup‐
826       ports the sanitizers that you want to enable
827
828   Usage
829       Simply add:
830
831          include(ECMEnableSanitizers)
832
833       to your CMakeLists.txt. Note that this module is included in KDECompil‐
834       erSettings, so projects using that module do not need to  also  include
835       this one.
836
837       The  sanitizers  are  not  enabled  by  default.  Instead, you must set
838       ECM_ENABLE_SANITIZERS (either in your CMakeLists.txt or on the  command
839       line)  to  a semicolon-separated list of sanitizers you wish to enable.
840       The options are:
841
842       • address
843
844       • memory
845
846       • thread
847
848       • leak
849
850       • undefined
851
852       • fuzzer
853
854       The sanitizers “address”, “memory” and “thread” are mutually exclusive.
855       You cannot enable two of them in the same build.
856
857       “leak” requires the  “address” sanitizer.
858
859       NOTE:
860          To  reduce  the overhead induced by the instrumentation of the sani‐
861          tizers, it is advised  to  enable  compiler  optimizations  (-O1  or
862          higher).
863
864   Example
865       This is an example of usage:
866
867          mkdir build
868          cd build
869          cmake -DECM_ENABLE_SANITIZERS='address;leak;undefined' ..
870
871       NOTE:
872          Most of the sanitizers will require Clang. To enable it, use:
873
874              -DCMAKE_CXX_COMPILER=clang++
875
876       Since 1.3.0.
877
878   ECMFindModuleHelpers
879       Helper   macros  for  find  modules:  ecm_find_package_version_check(),
880       ecm_find_package_parse_components()   and   ecm_find_package_handle_li‐
881       brary_components().
882
883          ecm_find_package_version_check(<name>)
884
885       Prints  warnings  if  the CMake version or the project’s required CMake
886       version is older than that required by extra-cmake-modules.
887
888          ecm_find_package_parse_components(<name>
889              RESULT_VAR <variable>
890              KNOWN_COMPONENTS <component1> [<component2> [...]]
891              [SKIP_DEPENDENCY_HANDLING])
892
893       This macro will populate <variable> with a list of components found  in
894       <name>_FIND_COMPONENTS, after checking that all those components are in
895       the list of KNOWN_COMPONENTS; if there are any unknown  components,  it
896       will   print   an   error   or  warning  (depending  on  the  value  of
897       <name>_FIND_REQUIRED) and call return().
898
899       The order of components in <variable> is guaranteed to match the  order
900       they are listed in the KNOWN_COMPONENTS argument.
901
902       If SKIP_DEPENDENCY_HANDLING is not set, for each component the variable
903       <name>_<component>_component_deps will be checked for dependent  compo‐
904       nents.   If  <component>  is listed in <name>_FIND_COMPONENTS, then all
905       its (transitive) dependencies will also be added to <variable>.
906
907          ecm_find_package_handle_library_components(<name>
908              COMPONENTS <component> [<component> [...]]
909              [SKIP_DEPENDENCY_HANDLING])
910              [SKIP_PKG_CONFIG])
911
912       Creates an imported library target for each component.   The  operation
913       of this macro depends on the presence of a number of CMake variables.
914
915       The <name>_<component>_lib variable should contain the name of this li‐
916       brary, and <name>_<component>_header variable should contain  the  name
917       of a header file associated with it (whatever relative path is normally
918       passed to ‘#include’). <name>_<component>_header_subdir variable can be
919       used to specify which subdirectory of the include path the headers will
920       be found in.  ecm_find_package_components() will then  search  for  the
921       library  and  include  directory (creating appropriate cache variables)
922       and create an imported library target named <name>::<component>.
923
924       Additional variables can be used to provide additional information:
925
926       If SKIP_PKG_CONFIG, the <name>_<component>_pkg_config variable is  set,
927       and  pkg-config is found, the pkg-config module given by <name>_<compo‐
928       nent>_pkg_config will be searched for and used to help locate  the  li‐
929       brary  and  header  file.   It  will also be used to set <name>_<compo‐
930       nent>_VERSION.
931
932       Note that if version information is found via pkg-config,  <name>_<com‐
933       ponent>_FIND_VERSION  can  be  set  to require a particular version for
934       each component.
935
936       If SKIP_DEPENDENCY_HANDLING is not  set,  the  INTERFACE_LINK_LIBRARIES
937       property  of the imported target for <component> will be set to contain
938       the imported  targets  for  the  components  listed  in  <name>_<compo‐
939       nent>_component_deps.   <component>_FOUND  will also be set to FALSE if
940       any of the  components  in  <name>_<component>_component_deps  are  not
941       found.   This  requires  the  components  in  <name>_<component>_compo‐
942       nent_deps to be listed before <component> in the COMPONENTS argument.
943
944       The following variables will be set:
945
946       <name>_TARGETS
947              the imported targets
948
949       <name>_LIBRARIES
950              the found libraries
951
952       <name>_INCLUDE_DIRS
953              the combined required include directories for the components
954
955       <name>_DEFINITIONS
956              the “other” CFLAGS provided by pkg-config, if any
957
958       <name>_VERSION
959              the value of <name>_<component>_VERSION for the first  component
960              that  has  this  variable set (note that components are searched
961              for in the order they are passed to the macro), although  if  it
962              is already set, it will not be altered
963
964       NOTE:
965          These variables are never cleared, so if ecm_find_package_handle_li‐
966          brary_components() is called multiple times  with  different  compo‐
967          nents  (typically  because  of  multiple  find_package() calls) then
968          <name>_TARGETS, for example, will contain all the targets  found  in
969          any call (although no duplicates).
970
971       Since pre-1.0.0.
972
973   ECMFindQmlModule
974       Find  QML  import modules through a find_qmlmodule() call.  It uses the
975       qmlplugindump application to find the plugins and sets them up as  run‐
976       time dependencies.
977
978       This is useful so that when we configure a project we are notified when
979       some QML imports are not present in the system, thus having the  appli‐
980       cation compilable but fail at runtime.
981
982          ecm_find_qmlmodule(<module_name> <version>...)
983
984       Any  further  arguments  passed will be forwarded into a find_package()
985       call. See find_package() documentation for more information.
986
987       Usage example:
988
989          ecm_find_qmlmodule(org.kde.kirigami 2.1)
990
991       Since 5.38.0.
992
993   ECMGenerateDBusServiceFile
994       This module provides the  ecm_generate_dbus_service_file  function  for
995       generating and installing a D-Bus service file.
996
997          ecm_generate_dbus_service_file(
998              NAME <service name>
999              EXECUTABLE <executable>
1000              [SYSTEMD_SERVICE <systemd service>]
1001              DESTINATION <install_path>
1002              [RENAME <dbus service filename>] # Since 5.75
1003          )
1004
1005       A  D-Bus  service file <service name>.service will be generated and in‐
1006       stalled in the relevant D-Bus config location.  This  filename  can  be
1007       customized with RENAME.
1008
1009       <executable>  must  be  an  absolute path to the installed service exe‐
1010       cutable. When using it with KDEInstallDirs it needs to  be  the  _FULL_
1011       variant of the path variable.
1012
1013       NOTE:
1014          On  Windows,  the  macro  will  only use the file name part of <exe‐
1015          cutable> since D-Bus service executables are to be installed in  the
1016          same directory as the D-Bus daemon.
1017
1018       Optionally,  a  <systemd service> can be specified to launch the corre‐
1019       sponding systemd service instead of the <executable> if the D-Bus  dae‐
1020       mon is started by systemd.
1021
1022       Example usage:
1023
1024          ecm_generate_dbus_service_file(
1025              NAME org.kde.kded5
1026              EXECUTABLE ${KDE_INSTALL_FULL_BINDIR}/kded5
1027              DESTINATION ${KDE_INSTALL_DBUSSERVICEDIR}
1028          )
1029
1030          ecm_generate_dbus_service_file(
1031              NAME org.kde.kded5
1032              EXECUTABLE ${KDE_INSTALL_FULL_BINDIR}/kded5
1033              SYSTEMD_SERVICE plasma-kded.service
1034              DESTINATION ${KDE_INSTALL_DBUSSERVICEDIR}
1035              RENAME org.kde.daemon.service
1036          )
1037
1038       Since 5.73.0.
1039
1040   ECMGenerateExportHeader
1041       This module provides the ecm_generate_export_header function for gener‐
1042       ating export macros for libraries with version-based control over visi‐
1043       bility  of  and  compiler  warnings  for deprecated API for the library
1044       user, as well as over excluding deprecated API and their implementation
1045       when building the library itself.
1046
1047       For  preparing  some  values  useful  in the context it also provides a
1048       function ecm_export_header_format_version.
1049
1050          ecm_generate_export_header(<library_target_name>
1051              VERSION <version>
1052              [BASE_NAME <base_name>]
1053              [GROUP_BASE_NAME <group_base_name>]
1054              [EXPORT_MACRO_NAME <export_macro_name>]
1055              [EXPORT_FILE_NAME <export_file_name>]
1056              [DEPRECATED_MACRO_NAME <deprecated_macro_name>]
1057              [NO_EXPORT_MACRO_NAME <no_export_macro_name>]
1058              [INCLUDE_GUARD_NAME <include_guard_name>]
1059              [STATIC_DEFINE <static_define>]
1060              [PREFIX_NAME <prefix_name>]
1061              [DEPRECATED_BASE_VERSION <deprecated_base_version>]
1062              [DEPRECATION_VERSIONS <deprecation_version> [<deprecation_version2> [...]]]
1063              [EXCLUDE_DEPRECATED_BEFORE_AND_AT <exclude_deprecated_before_and_at_version>]
1064              [NO_BUILD_SET_DEPRECATED_WARNINGS_SINCE]
1065              [NO_DEFINITION_EXPORT_TO_BUILD_INTERFACE]
1066              [CUSTOM_CONTENT_FROM_VARIABLE <variable>]
1067          )
1068
1069       VERSION specifies the version of the library, given in the format “<ma‐
1070       jor>.<minor>.<patchlevel>”.
1071
1072       GROUP_BASE_NAME  specifies  the name to use for the macros defining li‐
1073       brary group default values. If set, this will generate code  supporting
1074       <group_base_name>_NO_DEPRECATED_WARNINGS,        <group_base_name>_DIS‐
1075       ABLE_DEPRECATED_BEFORE_AND_AT,       <group_base_name>_DEPRECATED_WARN‐
1076       INGS_SINCE   and  <group_base_name>_NO_DEPRECATED  (see below).  If not
1077       set, the generated code will ignore any such macros.
1078
1079       DEPRECATED_BASE_VERSION specifies the default  version  before  and  at
1080       which  deprecated  API  is disabled. Possible values are “0”, “CURRENT”
1081       (which resolves to <version>) and a version string in the format  “<ma‐
1082       jor>.<minor>.<patchlevel>”.  The default is the value of “<exclude_dep‐
1083       recated_before_and_at_version>” if set, or “<major>.0.0”, with  <major>
1084       taken from <version>.
1085
1086       DEPRECATION_VERSIONS  specifies versions in “<major>.<minor>” format in
1087       which API was declared deprecated. Any version used with the  generated
1088       macro  <prefix_name><base_name>_DEPRECATED_VERSION(major,  minor, text)
1089       or  <prefix_name><base_name>_DEPRECATED_VERSION_BELATED(major,   minor,
1090       textmajor,  textminor,  text)  needs  to  be listed here, otherwise the
1091       macro will fail to work.
1092
1093       EXCLUDE_DEPRECATED_BEFORE_AND_AT specifies the version  for  which  all
1094       API  deprecated  before  and  at should be excluded from the build com‐
1095       pletely.  Possible values are “0” (default), “CURRENT” (which  resolves
1096       to  <version>)  and  a  version  string  in  the  format  “<major>.<mi‐
1097       nor>.<patchlevel>”.
1098
1099       NO_BUILD_SET_DEPRECATED_WARNINGS_SINCE specifies  that  the  definition
1100       <prefix_name><uppercase_base_name>_DEPRECATED_WARNINGS_SINCE  will  not
1101       be set for the library inside its own build, and thus will  be  defined
1102       by  either  explicit definition in the build system configuration or by
1103       the default value mechanism (see below).  The default is that it is set
1104       for  the  build,  to  the  version  specified by EXCLUDE_DEPRECATED_BE‐
1105       FORE_AND_AT, so no deprecation warnings are done for any own deprecated
1106       API used in the library implementation itself.
1107
1108       NO_DEFINITION_EXPORT_TO_BUILD_INTERFACE  specifies  that the definition
1109       <prefix_name><uppercase_base_name>_DISABLE_DEPRECATED_BEFORE_AND_AT
1110       will  not  be set in the public interface of the library inside its own
1111       build,  and  the   same   for   the   definition   <prefix_name><upper‐
1112       case_base_name>_DEPRECATED_WARNINGS_SINCE    (if    not   disabled   by
1113       NO_BUILD_SET_DEPRECATED_WARNINGS_SINCE already).  The default  is  that
1114       they  are  set,  to  the  version  specified  by EXCLUDE_DEPRECATED_BE‐
1115       FORE_AND_AT, so e.g. test and examples part of  the  project  automati‐
1116       cally  build against the full API included in the build and without any
1117       deprecation warnings for it.
1118
1119       The function ecm_generate_export_header defines C++ preprocessor macros
1120       in  the generated export header, some for use in the sources of the li‐
1121       brary the header is generated for, other for use  by  projects  linking
1122       agsinst the library.
1123
1124       The  macros for use in the library C++ sources are these, next to those
1125       also defined by GenerateExportHeader:
1126
1127       <prefix_name><uppercase_base_name>_DEPRECATED_VERSION(major,     minor,
1128       text)
1129              to    use    to   conditionally   set   a   <prefix_name><upper‐
1130              case_base_name>_DEPRECATED macro for a class, struct or function
1131              (other  elements  to be supported in future versions), depending
1132              on the visibility macro flags set (see below)
1133
1134       <prefix_name><uppercase_base_name>_DEPRECATED_VERSION_BELATED(major,
1135       minor, textmajor, textminor, text)
1136              to    use    to   conditionally   set   a   <prefix_name><upper‐
1137              case_base_name>_DEPRECATED macro for a class, struct or function
1138              (other  elements  to be supported in future versions), depending
1139              on the visibility macro flags set (see below), with major &  mi‐
1140              nor  applied  for  the  logic  and textmajor & textminor for the
1141              warnings message.  Useful for retroactive tagging of API for the
1142              compiler  without  injecting  the  API into the compiler warning
1143              conditions of already released versions.  Since 5.71.
1144
1145       <prefix_name><uppercase_base_name>_ENUMERATOR_DEPRECATED_VERSION(major,
1146       minor, text)
1147              to    use    to   conditionally   set   a   <prefix_name><upper‐
1148              case_base_name>_DEPRECATED macro for an enumerator, depending on
1149              the  warnings macro flags set (see below). In builds using C++14
1150              standard or earlier, where enumerator  attributes  are  not  yet
1151              supported,  the  macro  will always yield an empty string.  With
1152              MSVC it is also always an empty string for now.  Since 5.82.
1153
1154       <prefix_name><uppercase_base_name>_ENUMERATOR_DEPRECATED_VERSION_BE‐
1155       LATED(major, minor, textmajor, textminor, text)
1156              to    use    to   conditionally   set   a   <prefix_name><upper‐
1157              case_base_name>_DEPRECATED macro for an enumerator, depending on
1158              the warnings macro flags set (see below), with major & minor ap‐
1159              plied for the logic and textmajor & textminor for  the  warnings
1160              message.   In builds using C++14 standard or earlier, where enu‐
1161              merator attributes are not yet supported, the macro will  always
1162              yield  an  empty  string.  Useful for retroactive tagging of API
1163              for the compiler without injecting the  API  into  the  compiler
1164              warning  conditions  of already released versions.  With MSVC it
1165              is also always an empty string for now.  Since 5.82.
1166
1167       <prefix_name><uppercase_base_name>_ENABLE_DEPRECATED_SINCE(major,   mi‐
1168       nor)
1169              evaluates  to  TRUE  or  FALSE depending on the visibility macro
1170              flags set (see below). To be used mainly with #if/#endif to mark
1171              sections of code which should be included depending on the visi‐
1172              bility requested.
1173
1174       <prefix_name><uppercase_base_name>_BUILD_DEPRECATED_SINCE(major, minor)
1175              evaluates to TRUE  or  FALSE  depending  on  the  value  of  EX‐
1176              CLUDE_DEPRECATED_BEFORE_AND_AT.  To be used mainly with #if/#en‐
1177              dif to mark sections of two types of code:  implementation  code
1178              for  deprecated API and declaration code of deprecated API which
1179              only may be disabled at build time of the library for BC reasons
1180              (e.g. virtual methods, see notes below).
1181
1182       <prefix_name><uppercase_base_name>_EXCLUDE_DEPRECATED_BEFORE_AND_AT
1183              holds  the  version used to exclude deprecated API at build time
1184              of the library.
1185
1186       The macros used to control visibility when building against the library
1187       are:
1188
1189       <prefix_name><uppercase_base_name>_DISABLE_DEPRECATED_BEFORE_AND_AT
1190              definition  to set to a value in single hex number version nota‐
1191              tion (0x<major><minor><patchlevel>).
1192
1193       <prefix_name><uppercase_base_name>_NO_DEPRECATED
1194              flag to define to disable all deprecated API, being  a  shortcut
1195              for  settings  <prefix_name><uppercase_base_name>_DISABLE_DEPRE‐
1196              CATED_BEFORE_AND_AT to the current version.  If  both  are  set,
1197              this flag overrules.
1198
1199       <prefix_name><uppercase_base_name>_DEPRECATED_WARNINGS_SINCE
1200              definition  to set to a value in single hex number version nota‐
1201              tion (0x<major><minor><patchlevel>). Warnings will be only acti‐
1202              vated  for  API  deprecated  up to and including the version. If
1203              <prefix_name><uppercase_base_name>_DISABLE_DEPRECATED_BE‐
1204              FORE_AND_AT  is set (directly or via the group default), it will
1205              default to that version, resulting in no warnings. Otherwise the
1206              default  is  the  current version, resulting in warnings for all
1207              deprecated API.
1208
1209       <prefix_name><uppercase_base_name>_NO_DEPRECATED_WARNINGS
1210              flag to define to disable  all  deprecation  warnings,  being  a
1211              shortcut  for  setting <prefix_name><uppercase_base_name>_DEPRE‐
1212              CATED_WARNINGS_SINCE to “0”. If both are set,  this  flag  over‐
1213              rules.
1214
1215       When  the  GROUP_BASE_NAME  has been used, the same macros but with the
1216       given <group_base_name> prefix are available to define the defaults  of
1217       these macros, if not explicitly set.
1218
1219       WARNING:
1220          The  tricks  applied  here for hiding deprecated API to the compiler
1221          when building against a library do not work for all deprecated API:
1222
1223          • virtual methods need to stay visible  to  the  compiler  to  build
1224            proper virtual method tables for subclasses
1225
1226          • enumerators  from  enums cannot be simply removed, as this changes
1227            auto values of following enumerators, also can poke holes in  enu‐
1228            merator series used as index into tables
1229
1230          In  such cases the API can be only “hidden” at build time of the li‐
1231          brary, itself, by generated hard coded macro settings,  using  <pre‐
1232          fix_name><uppercase_base_name>_BUILD_DEPRECATED_SINCE(major, minor).
1233
1234       Examples:
1235
1236       Preparing  a  library “Foo” created by target “foo”, which is part of a
1237       group of libraries “Bar”, where some API of  “Foo”  got  deprecated  at
1238       versions 5.0 & 5.12:
1239
1240          ecm_generate_export_header(foo
1241              GROUP_BASE_NAME BAR
1242              VERSION ${FOO_VERSION}
1243              DEPRECATION_VERSIONS 5.0 5.12
1244          )
1245
1246       In  the  library “Foo” sources in the headers the API would be prepared
1247       like this, using the generated macros  FOO_ENABLE_DEPRECATED_SINCE  and
1248       FOO_DEPRECATED_VERSION:
1249
1250          #include <foo_export.h>
1251
1252          #if FOO_ENABLE_DEPRECATED_SINCE(5, 0)
1253          /**
1254            * @deprecated Since 5.0
1255            */
1256          FOO_EXPORT
1257          FOO_DEPRECATED_VERSION(5, 0, "Use doFoo2()")
1258          void doFoo();
1259          #endif
1260
1261          #if FOO_ENABLE_DEPRECATED_SINCE(5, 12)
1262          /**
1263            * @deprecated Since 5.12
1264            */
1265          FOO_EXPORT
1266          FOO_DEPRECATED_VERSION(5, 12, "Use doBar2()")
1267          void doBar();
1268          #endif
1269
1270       Projects  linking  against  the “Foo” library can control which part of
1271       its deprecated API should be hidden to the compiler by adding a defini‐
1272       tion  using the FOO_DISABLE_DEPRECATED_BEFORE_AND_AT macro variable set
1273       to the desired value (in version hex number notation):
1274
1275          add_definitions(-DFOO_DISABLE_DEPRECATED_BEFORE_AND_AT=0x050000)
1276
1277       Or using the macro variable of the group:
1278
1279          add_definitions(-DBAR_DISABLE_DEPRECATED_BEFORE_AND_AT=0x050000)
1280
1281       If both are specified, FOO_DISABLE_DEPRECATED_BEFORE_AND_AT  will  take
1282       precedence.
1283
1284       To  build  a  variant  of a library with some deprecated API completely
1285       left out from the build, not only optionally  invisible  to  consumers,
1286       one  uses  the EXCLUDE_DEPRECATED_BEFORE_AND_AT parameter. This is best
1287       combined with a cached CMake variable.
1288
1289          set(EXCLUDE_DEPRECATED_BEFORE_AND_AT 0 CACHE STRING "Control the range of deprecated API excluded from the build [default=0].")
1290
1291          ecm_generate_export_header(foo
1292              VERSION ${FOO_VERSION}
1293              EXCLUDE_DEPRECATED_BEFORE_AND_AT ${EXCLUDE_DEPRECATED_BEFORE_AND_AT}
1294              DEPRECATION_VERSIONS 5.0 5.12
1295          )
1296
1297       The macros used in the headers for library  consumers  are  reused  for
1298       disabling  the  API excluded in the build of the library. For disabling
1299       the implementation of that API as well as for disabling deprecated  API
1300       which only can be disabled at build time of the library for BC reasons,
1301       one uses the generated macro FOO_BUILD_DEPRECATED_SINCE, like this:
1302
1303          #include <foo_export.h>
1304
1305          enum Bars {
1306              One,
1307          #if FOO_BUILD_DEPRECATED_SINCE(5, 0)
1308              Two FOO_ENUMERATOR_DEPRECATED_VERSION(5, 0, "Use Three"), // macro available since 5.82
1309          #endif
1310              Three,
1311          };
1312
1313          #if FOO_ENABLE_DEPRECATED_SINCE(5, 0)
1314          /**
1315            * @deprecated Since 5.0
1316            */
1317          FOO_EXPORT
1318          FOO_DEPRECATED_VERSION(5, 0, "Use doFoo2()")
1319          void doFoo();
1320          #endif
1321
1322          #if FOO_ENABLE_DEPRECATED_SINCE(5, 12)
1323          /**
1324            * @deprecated Since 5.12
1325            */
1326          FOO_EXPORT
1327          FOO_DEPRECATED_VERSION(5, 12, "Use doBar2()")
1328          void doBar();
1329          #endif
1330
1331          class FOO_EXPORT Foo {
1332          public:
1333          #if FOO_BUILD_DEPRECATED_SINCE(5, 0)
1334              /**
1335                * @deprecated Since 5.0
1336                */
1337              FOO_DEPRECATED_VERSION(5, 0, "Feature removed")
1338              virtual void doWhat();
1339          #endif
1340          };
1341
1342          #if FOO_BUILD_DEPRECATED_SINCE(5, 0)
1343          void doFoo()
1344          {
1345              // [...]
1346          }
1347          #endif
1348
1349          #if FOO_BUILD_DEPRECATED_SINCE(5, 12)
1350          void doBar()
1351          {
1352              // [...]
1353          }
1354          #endif
1355
1356          #if FOO_BUILD_DEPRECATED_SINCE(5, 0)
1357          void Foo::doWhat()
1358          {
1359              // [...]
1360          }
1361          #endif
1362
1363       So e.g. if EXCLUDE_DEPRECATED_BEFORE_AND_AT is set to “5.0.0”, the enu‐
1364       merator  Two as well as the methods ::doFoo() and Foo::doWhat() will be
1365       not available to library consumers. The methods will not have been com‐
1366       piled  into  the library binary, and the declarations will be hidden to
1367       the compiler, FOO_DISABLE_DEPRECATED_BEFORE_AND_AT also cannot be  used
1368       to reactivate them.
1369
1370       When  using the NO_DEFINITION_EXPORT_TO_BUILD_INTERFACE and the project
1371       for the “Foo” library includes also tests and examples linking  against
1372       the library and using deprecated API (like tests covering it), one bet‐
1373       ter explicitly sets FOO_DISABLE_DEPRECATED_BEFORE_AND_AT for those tar‐
1374       gets to the version before and at which all deprecated API has been ex‐
1375       cluded from the build.  Even more when building against other libraries
1376       from  the  same  group “Bar” and disabling some deprecated API of those
1377       libraries using the group  macro  BAR_DISABLE_DEPRECATED_BEFORE_AND_AT,
1378       which also works as default for FOO_DISABLE_DEPRECATED_BEFORE_AND_AT.
1379
1380       To   get   the   hex  number  style  value  the  helper  macro  ecm_ex‐
1381       port_header_format_version() will be used:
1382
1383          set(EXCLUDE_DEPRECATED_BEFORE_AND_AT 0 CACHE STRING "Control what part of deprecated API is excluded from build [default=0].")
1384
1385          ecm_generate_export_header(foo
1386              VERSION ${FOO_VERSION}
1387              GROUP_BASE_NAME BAR
1388              EXCLUDE_DEPRECATED_BEFORE_AND_AT ${EXCLUDE_DEPRECATED_BEFORE_AND_AT}
1389              NO_DEFINITION_EXPORT_TO_BUILD_INTERFACE
1390              DEPRECATION_VERSIONS 5.0 5.12
1391          )
1392
1393          ecm_export_header_format_version(${EXCLUDE_DEPRECATED_BEFORE_AND_AT}
1394              CURRENT_VERSION ${FOO_VERSION}
1395              HEXNUMBER_VAR foo_no_deprecated_before_and_at
1396          )
1397
1398          # disable all deprecated API up to 5.9.0 from all other libs of group "BAR" that we use ourselves
1399          add_definitions(-DBAR_DISABLE_DEPRECATED_BEFORE_AND_AT=0x050900)
1400
1401          add_executable(app app.cpp)
1402          target_link_libraries(app foo)
1403          target_compile_definitions(app
1404               PRIVATE "FOO_DISABLE_DEPRECATED_BEFORE_AND_AT=${foo_no_deprecated_before_and_at}")
1405
1406       Since 5.64.0.
1407
1408   ECMGenerateHeaders
1409       Generate C/C++ CamelCase forwarding headers.
1410
1411          ecm_generate_headers(<camelcase_forwarding_headers_var>
1412              HEADER_NAMES <CamelCaseName> [<CamelCaseName> [...]]
1413              [ORIGINAL <CAMELCASE|LOWERCASE>]
1414              [HEADER_EXTENSION <header_extension>]
1415              [OUTPUT_DIR <output_dir>]
1416              [PREFIX <prefix>]
1417              [REQUIRED_HEADERS <variable>]
1418              [COMMON_HEADER <HeaderName>]
1419              [RELATIVE <relative_path>])
1420
1421       For each CamelCase header name passed to HEADER_NAMES, a file  of  that
1422       name  will be generated that will include a version with .h or, if set,
1423       .<header_extension> appended.  For example, the generated header ClassA
1424       will  include classa.h (or ClassA.h, see ORIGINAL).  If a CamelCaseName
1425       consists of multiple comma-separated files, e.g.  ClassA,ClassB,ClassC,
1426       then  multiple camelcase header files will be generated which are redi‐
1427       rects to the first header file.  The file locations of these  generated
1428       headers will be stored in <camelcase_forwarding_headers_var>.
1429
1430       ORIGINAL specifies how the name of the original header is written: low‐
1431       ercased or also camelcased.  The default is “LOWERCASE”. Since 1.8.0.
1432
1433       HEADER_EXTENSION specifies what file name extension  is  used  for  the
1434       header files.  The default is “h”. Since 5.48.0.
1435
1436       PREFIX  places the generated headers in subdirectories.  This should be
1437       a CamelCase name like KParts, which will cause the CamelCase forwarding
1438       headers  to  be  placed in the KParts directory (e.g. KParts/Part).  It
1439       will also, for the convenience of code in the source distribution, gen‐
1440       erate   forwarding   headers   based   on   the  original  names  (e.g.
1441       kparts/part.h).  This allows includes like  "#include  <kparts/part.h>"
1442       to  be used before installation, as long as the include_directories are
1443       set appropriately.
1444
1445       OUTPUT_DIR specifies where the files will be generated; this should  be
1446       within  the  build  directory.  By default, ${CMAKE_CURRENT_BINARY_DIR}
1447       will be used.  This option can be used to avoid file conflicts.
1448
1449       REQUIRED_HEADERS specifies an output variable name where  all  the  re‐
1450       quired  headers will be appended so that they can be installed together
1451       with the generated ones.  This is mostly intended as a  convenience  so
1452       that  adding  a  new  header  to a project only requires specifying the
1453       CamelCase variant in the CMakeLists.txt file; the original variant will
1454       then be added to this variable.
1455
1456       COMMON_HEADER generates an additional convenience header which includes
1457       all other header files.
1458
1459       The RELATIVE argument indicates where the original headers can be found
1460       relative to CMAKE_CURRENT_SOURCE_DIR.  It does not affect the generated
1461       CamelCase forwarding files, but  ecm_generate_headers()  uses  it  when
1462       checking  that  the  original header exists, and to generate originally
1463       named forwarding headers when PREFIX is set.
1464
1465       To allow other parts of the source distribution (eg: tests) to use  the
1466       generated  headers  before installation, it may be desirable to set the
1467       INCLUDE_DIRECTORIES property for the library target to output_dir.  For
1468       example,  if  OUTPUT_DIR is CMAKE_CURRENT_BINARY_DIR (the default), you
1469       could do
1470
1471          target_include_directories(MyLib PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>")
1472
1473       Example usage (without PREFIX):
1474
1475          ecm_generate_headers(
1476              MyLib_FORWARDING_HEADERS
1477              HEADERS
1478                  MLFoo
1479                  MLBar
1480                  # etc
1481              REQUIRED_HEADERS MyLib_HEADERS
1482              COMMON_HEADER MLGeneral
1483          )
1484          install(FILES ${MyLib_FORWARDING_HEADERS} ${MyLib_HEADERS}
1485                  DESTINATION ${CMAKE_INSTALL_PREFIX}/include
1486                  COMPONENT Devel)
1487
1488       Example usage (with PREFIX):
1489
1490          ecm_generate_headers(
1491              MyLib_FORWARDING_HEADERS
1492              HEADERS
1493                  Foo
1494                  # several classes are contained in bar.h, so generate
1495                  # additional files
1496                  Bar,BarList
1497                  # etc
1498              PREFIX MyLib
1499              REQUIRED_HEADERS MyLib_HEADERS
1500          )
1501          install(FILES ${MyLib_FORWARDING_HEADERS}
1502                  DESTINATION ${CMAKE_INSTALL_PREFIX}/include/MyLib
1503                  COMPONENT Devel)
1504          install(FILES ${MyLib_HEADERS}
1505                  DESTINATION ${CMAKE_INSTALL_PREFIX}/include/mylib
1506                  COMPONENT Devel)
1507
1508       Since pre-1.0.0.
1509
1510   ECMGeneratePkgConfigFile
1511       Generate a pkg-config file for the benefit of autotools-based projects.
1512
1513          ecm_generate_pkgconfig_file(BASE_NAME <baseName>
1514                                [LIB_NAME <libName>]
1515                                [DEPS [PRIVATE|PUBLIC] <dep> [[PRIVATE|PUBLIC] <dep> [...]]]
1516                                [FILENAME_VAR <filename_variable>]
1517                                [INCLUDE_INSTALL_DIR <dir>]
1518                                [LIB_INSTALL_DIR <dir>]
1519                                [DEFINES -D<variable=value>...]
1520                                [DESCRIPTION <library description>] # since 5.41.0
1521                                [URL <url>] # since 5.89.0
1522                                [INSTALL])
1523
1524       BASE_NAME is the name of the module. It’s the name projects will use to
1525       find the module.
1526
1527       LIB_NAME  is  the  name of the library that is being exported. If unde‐
1528       fined, it will default to the BASE_NAME. That means the  LIB_NAME  will
1529       be set as the name field as well as the library to link to.
1530
1531       DEPS  is the list of libraries required by this library. Libraries that
1532       are not exposed to applications should be marked with PRIVATE. The  de‐
1533       fault  is  PUBLIC,  but  note that according to the Guide to pkg-config
1534       marking dependencies as private is usually preferred.  The  PUBLIC  and
1535       PRIVATE keywords are supported since 5.89.0.
1536
1537       FILENAME_VAR  is specified with a variable name. This variable will re‐
1538       ceive the location of the generated file will be set, within the  build
1539       directory. This way it can be used in case some processing is required.
1540       See also INSTALL.
1541
1542       INCLUDE_INSTALL_DIR specifies where the includes will be installed.  If
1543       it’s  not  specified,  it will default to INSTALL_INCLUDEDIR, CMAKE_IN‐
1544       STALL_INCLUDEDIR or just “include/” in case they  are  specified,  with
1545       the BASE_NAME postfixed.
1546
1547       LIB_INSTALL_DIR specifies where the library is being installed. If it’s
1548       not specified, it will default to LIB_INSTALL_DIR, CMAKE_INSTALL_LIBDIR
1549       or just “lib/” in case they are specified.
1550
1551       DEFINES  is a list of preprocessor defines that it is recommended users
1552       of the library pass to the compiler when using it.
1553
1554       DESCRIPTION describes what this library  is.  If  it’s  not  specified,
1555       CMake will first try to get the description from the metainfo.yaml file
1556       or will create one based on LIB_NAME. Since 5.41.0.
1557
1558       URL An URL where people can get more information about and download the
1559       package. Defaults to “https://www.kde.org/”. Since 5.89.0.
1560
1561       INSTALL  will  cause the module to be installed to the pkgconfig subdi‐
1562       rectory of LIB_INSTALL_DIR, unless the ECM_PKGCONFIG_INSTALL_DIR  cache
1563       variable is set to something different.
1564
1565       NOTE:
1566          The first call to ecm_generate_pkgconfig_file() with the INSTALL ar‐
1567          gument will cause ECM_PKGCONFIG_INSTALL_DIR to be set to the  cache,
1568          and will be used in any subsequent calls.
1569
1570       To  properly  use this macro a version needs to be set. To retrieve it,
1571       ECM_PKGCONFIG_INSTALL_DIR uses PROJECT_VERSION.  To  set  it,  use  the
1572       project() command or the ecm_setup_version() macro
1573
1574       Example usage:
1575
1576          ecm_generate_pkgconfig_file(
1577              BASE_NAME KF5Archive
1578              DEPS Qt5Core
1579              FILENAME_VAR pkgconfig_filename
1580              INSTALL
1581          )
1582
1583       Since 1.3.0.
1584
1585   ECMGeneratePriFile
1586       Generate a .pri file for the benefit of qmake-based projects.
1587
1588       As  well  as the function below, this module creates the cache variable
1589       ECM_MKSPECS_INSTALL_DIR and sets the default value to  mkspecs/modules.
1590       This  assumes Qt and the current project are both installed to the same
1591       non-system prefix.  Packagers who use -DCMAKE_INSTALL_PREFIX=/usr  will
1592       certainly   want  to  set  ECM_MKSPECS_INSTALL_DIR  to  something  like
1593       share/qt5/mkspecs/modules.
1594
1595       The main thing is that this should be the modules subdirectory  of  ei‐
1596       ther the default qmake mkspecs directory or of a directory that will be
1597       in the $QMAKEPATH environment variable when qmake is run.
1598
1599          ecm_generate_pri_file(BASE_NAME <baseName>
1600                                LIB_NAME <libName>
1601                                [VERSION <version>] # since 5.83
1602                                [DEPS "<dep> [<dep> [...]]"]
1603                                [FILENAME_VAR <filename_variable>]
1604                                [INCLUDE_INSTALL_DIRS <dir> [<dir> [...]]]  # since 5.92
1605                                [INCLUDE_INSTALL_DIR <dir>] # deprecated since 5.92
1606                                [LIB_INSTALL_DIR <dir>])
1607
1608       If your CMake project produces a Qt-based library, you may expect there
1609       to  be  applications  that  wish to use it that use a qmake-based build
1610       system, rather than a CMake-based one.  Creating a .pri file will  make
1611       use  of  your  library  convenient  for them, in much the same way that
1612       CMake config files make things convenient for CMake-based applications.
1613       ecm_generate_pri_file() generates just such a file.
1614
1615       VERSION  specifies  the version of the library the .pri file describes.
1616       If not set, the value is taken from the context  variable  PROJECT_VER‐
1617       SION.   This  variable  is  usually set by the project(... VERSION ...)
1618       command or, if CMake policy CMP0048 is  not  NEW,  by  ECMSetupVersion.
1619       For  backward-compatibility  with  older  ECM versions the PROJECT_VER‐
1620       SION_STRING variable as set by ECMSetupVersion will be  preferred  over
1621       PROJECT_VERSION  if  set, unless the minimum required version of ECM is
1622       5.83 and newer. Since 5.83.
1623
1624       BASE_NAME specifies the name qmake project (.pro) files should  use  to
1625       refer  to  the library (eg: KArchive).  LIB_NAME is the name of the ac‐
1626       tual library to link to (ie:  the  first  argument  to  add_library()).
1627       DEPS  is  a  space-separated  list of the base names of other libraries
1628       (for Qt libraries, use the same names you use with the QT variable in a
1629       qmake project file, such as “core” for QtCore).  FILENAME_VAR specifies
1630       the name of a variable to store the path to the generated file in.
1631
1632       INCLUDE_INSTALL_DIRS are the paths (relative  to  CMAKE_INSTALL_PREFIX)
1633       that  include  files will be installed to. It defaults to ${INCLUDE_IN‐
1634       STALL_DIR}/<baseName> if the INCLUDE_INSTALL_DIR variable  is  set.  If
1635       that variable is not set, the CMAKE_INSTALL_INCLUDEDIR variable is used
1636       instead, and if neither are set include is used.  LIB_INSTALL_DIR oper‐
1637       ates similarly for the installation location for libraries; it defaults
1638       to ${LIB_INSTALL_DIR}, ${CMAKE_INSTALL_LIBDIR} or lib, in that order.
1639
1640       INCLUDE_INSTALL_DIR is the old variant of INCLUDE_INSTALL_DIRS,  taking
1641       only one directory.
1642
1643       Example usage:
1644
1645          ecm_generate_pri_file(
1646              BASE_NAME KArchive
1647              LIB_NAME KF5KArchive
1648              DEPS "core"
1649              FILENAME_VAR pri_filename
1650              VERSION 4.2.0
1651          )
1652          install(FILES ${pri_filename} DESTINATION ${ECM_MKSPECS_INSTALL_DIR})
1653
1654       A qmake-based project that wished to use this would then do:
1655
1656          QT += KArchive
1657
1658       in their .pro file.
1659
1660       Since pre-1.0.0.
1661
1662   ECMGenerateQmlTypes
1663       Generates plugins.qmltypes files for QML plugins.
1664
1665          ecm_generate_qmltypes(<org.kde.pluginname> 1.3
1666                                DESTINATION <${KDE_INSTALL_QMLDIR}/org/kde/pluginname>)
1667
1668       Makes  it possible to generate plugins.qmltypes files for the QML plug‐
1669       ins that our project offers. These files offer introspection  upon  our
1670       plugin  and are useful for integrating with IDE language support of our
1671       plugin. It offers information about the objects its methods  and  their
1672       argument types.
1673
1674       The  developer will be in charge of making sure that these files are up
1675       to date.  The plugin.qmltypes file will sit in  the  source  directory.
1676       This function will include the code that installs the file in the right
1677       place and a small  unit  test  named  qmltypes-pluginname-version  that
1678       makes sure that it doesn’t need updating.
1679
1680       Since 5.33.0
1681
1682   ECMInstallIcons
1683       Installs  icons, sorting them into the correct directories according to
1684       the FreeDesktop.org icon naming specification.
1685
1686          ecm_install_icons(ICONS <icon> [<icon> [...]]
1687                            DESTINATION <icon_install_dir>
1688                            [LANG <l10n_code>]
1689                            [THEME <theme>])
1690
1691       The given icons, whose names must match the pattern:
1692
1693          <size>-<group>-<name>.<ext>
1694
1695       will be installed to the appropriate subdirectory  of  DESTINATION  ac‐
1696       cording to the FreeDesktop.org icon naming scheme. By default, they are
1697       installed to the “hicolor” theme, but this can  be  changed  using  the
1698       THEME  argument.   If the icons are localized, the LANG argument can be
1699       used to install them in a locale-specific directory.
1700
1701       <size> is a numeric pixel size (typically 16, 22, 32, 48,  64,  128  or
1702       256)  or  sc  for  scalable (SVG) files, <group> is one of the standard
1703       FreeDesktop.org icon groups (actions, animations, apps, categories, de‐
1704       vices,  emblems,  emotes, intl, mimetypes, places, status) and <ext> is
1705       one of .png, .mng or .svgz.
1706
1707       The typical installation directory is share/icons.
1708
1709          ecm_install_icons(ICONS 22-actions-menu_new.png
1710                            DESTINATION share/icons)
1711
1712       The  above  code  will  install  the  file  22-actions-menu_new.png  as
1713       ${CMAKE_INSTALL_PREFIX}/share/icons/<theme>/22x22/actions/menu_new.png
1714
1715       Users  of  the  KDEInstallDirs  module  would  normally  use  ${KDE_IN‐
1716       STALL_ICONDIR} as the DESTINATION, while users  of  the  GNUInstallDirs
1717       module should use ${CMAKE_INSTALL_DATAROOTDIR}/icons.
1718
1719       An old form of arguments will also be accepted:
1720
1721          ecm_install_icons(<icon_install_dir> [<l10n_code>])
1722
1723       This matches files named like:
1724
1725          <theme><size>-<group>-<name>.<ext>
1726
1727       where <theme> is one of
1728
1729hi for hicolor
1730
1731lo for locolor
1732
1733cr for the Crystal icon theme
1734
1735ox for the Oxygen icon theme
1736
1737br for the Breeze icon theme
1738
1739       With this syntax, the file hi22-actions-menu_new.png would be installed
1740       into <icon_install_dir>/hicolor/22x22/actions/menu_new.png
1741
1742       Since pre-1.0.0.
1743
1744   ECMMarkAsTest
1745       Marks a target as only being required for tests.
1746
1747          ecm_mark_as_test(<target1> [<target2> [...]])
1748
1749       This will cause the specified targets to not  be  built  unless  either
1750       BUILD_TESTING is set to ON or the user invokes the buildtests target.
1751
1752       BUILD_TESTING is created as a cache variable by the CTest module and by
1753       the KDECMakeSettings module.
1754
1755       Since pre-1.0.0.
1756
1757   ECMMarkNonGuiExecutable
1758       Marks an executable target as not being a GUI application.
1759
1760          ecm_mark_nongui_executable(<target1> [<target2> [...]])
1761
1762       This will indicate to CMake that the specified targets  should  not  be
1763       included  in  a  MACOSX_BUNDLE and should not be WIN32_EXECUTABLEs.  On
1764       platforms other than MacOS X or Windows, this will have no effect.
1765
1766       Since pre-1.0.0.
1767
1768   ECMOptionalAddSubdirectory
1769       Make subdirectories optional.
1770
1771          ecm_optional_add_subdirectory(<dir>)
1772
1773       This behaves like add_subdirectory(), except that it does not  complain
1774       if  the  directory does not exist.  Additionally, if the directory does
1775       exist, it creates an option to allow the user to skip  it.  The  option
1776       will be named BUILD_<dir>.
1777
1778       This is useful for “meta-projects” that combine several mostly-indepen‐
1779       dent sub-projects.
1780
1781       If the CMake variable  DISABLE_ALL_OPTIONAL_SUBDIRECTORIES  is  set  to
1782       TRUE  for  the first CMake run on the project, all optional subdirecto‐
1783       ries will be disabled by default (but can of course be enabled via  the
1784       respective  options).   For example, the following will disable all op‐
1785       tional subdirectories except the one named “foo”:
1786
1787          cmake -DDISABLE_ALL_OPTIONAL_SUBDIRECTORIES=TRUE -DBUILD_foo=TRUE myproject
1788
1789       Since pre-1.0.0.
1790
1791   ECMPackageConfigHelpers
1792       Helper macros for generating CMake package config files.
1793
1794       write_basic_package_version_file() is the same as the one  provided  by
1795       the  CMakePackageConfigHelpers module in CMake; see that module’s docu‐
1796       mentation for more information.
1797
1798          ecm_configure_package_config_file(<input> <output>
1799              INSTALL_DESTINATION <path>
1800              [PATH_VARS <var1> [<var2> [...]]
1801              [NO_SET_AND_CHECK_MACRO]
1802              [NO_CHECK_REQUIRED_COMPONENTS_MACRO])
1803
1804       This behaves in the same way  as  configure_package_config_file()  from
1805       CMake  2.8.12,  except  that it adds an extra helper macro: find_depen‐
1806       dency(). It is highly recommended that you read the  documentation  for
1807       CMakePackageConfigHelpers  for  more information, particularly with re‐
1808       gard to the PATH_VARS argument.
1809
1810       Note that there is no argument that will disable the  find_dependency()
1811       macro; if you do not require this macro, you should use configure_pack‐
1812       age_config_file from the CMakePackageConfigHelpers module.
1813
1814       CMake 3.0 includes a CMakeFindDependencyMacro module that provides  the
1815       find_dependency() macro (which you can include() in your package config
1816       file), so this file is only useful for projects wishing to provide con‐
1817       fig files that will work with CMake 2.8.12.
1818
1819   Additional Config File Macros
1820          find_dependency(<dep> [<version> [EXACT]])
1821
1822       find_dependency()  should  be  used  instead  of find_package() to find
1823       package dependencies.  It forwards the correct  parameters  for  EXACT,
1824       QUIET  and  REQUIRED  which  were passed to the original find_package()
1825       call.  It also sets an informative diagnostic message if the dependency
1826       could not be found.
1827
1828       Since pre-1.0.0.
1829
1830   ECMPoQmTools
1831       This   module   provides  the  ecm_process_po_files_as_qm  and  ecm_in‐
1832       stall_po_files_as_qm functions for generating QTranslator  (.qm)  cata‐
1833       logs from Gettext (.po) catalogs, and the ecm_create_qm_loader function
1834       for generating the necessary code to load them in a Qt  application  or
1835       library.
1836
1837          ecm_process_po_files_as_qm(<lang> [ALL]
1838                                     [INSTALL_DESTINATION <install_destination>]
1839                                     PO_FILES <pofile> [<pofile> [...]])
1840
1841       Compile .po files into .qm files for the given language.
1842
1843       If  INSTALL_DESTINATION  is  given, the .qm files are installed in <in‐
1844       stall_destination>/<lang>/LC_MESSAGES. Typically, <install_destination>
1845       is set to share/locale.
1846
1847       ecm_process_po_files_as_qm creates a “translations” target. This target
1848       builds all .po files into .qm files.  If ALL is specified, these  rules
1849       are  added  to  the “all” target (and so the .qm files will be built by
1850       default).
1851
1852          ecm_create_qm_loader(<sources_var_name(|target (since 5.83))> <catalog_name>)
1853
1854       Generates C++ code which ensures translations are automatically  loaded
1855       at  startup.  The  generated  files  are appended to the variable named
1856       <sources_var_name> or, if the first argument is a target (since  5.83),
1857       to  the  SOURCES  property of <target>. Any target must be created with
1858       add_executable() or add_library() and not be an alias.
1859
1860       It assumes that the .qm file for the language code <lang> is  installed
1861       as     <sharedir>/locale/<lang>/LC_MESSAGES/<catalog_name>.qm,    where
1862       <sharedir> is one of the directories given by  the  GenericDataLocation
1863       of QStandardPaths.
1864
1865       Typical usage is like:
1866
1867          set(mylib_SRCS foo.cpp bar.cpp)
1868          ecm_create_qm_loader(mylib_SRCS mycatalog)
1869          add_library(mylib ${mylib_SRCS})
1870
1871          # Or, since 5.83:
1872          add_library(mylib foo.cpp bar.cpp)
1873          ecm_create_qm_loader(mylib mycatalog)
1874
1875          ecm_install_po_files_as_qm(<podir>)
1876
1877       Searches for .po files and installs them to the standard location.
1878
1879       This is a convenience function which relies on all .po files being kept
1880       in <podir>/<lang>/, where <lang> is the  language  the  .po  files  are
1881       written in.
1882
1883       For example, given the following directory structure:
1884
1885          po/
1886            fr/
1887              mylib.po
1888
1889       ecm_install_po_files_as_qm(po)  compiles mylib.po into mylib.qm and in‐
1890       stalls it in  <install_destination>/fr/LC_MESSAGES.   <install_destina‐
1891       tion>  defaults  to ${LOCALE_INSTALL_DIR} if defined, otherwise it uses
1892       ${CMAKE_INSTALL_LOCALEDIR}  if  that  is  defined,  otherwise  it  uses
1893       share/locale.
1894
1895       Since pre-1.0.0.
1896
1897   ECMQmlModule
1898       This  file  contains  helper  functions to make it easier to create QML
1899       modules. It takes care of a number of things that often need to be  re‐
1900       peated.  It  also takes care of special handling of QML modules between
1901       shared and static builds. When building a static version of a QML  mod‐
1902       ule, the relevant QML source files are bundled into the static library.
1903       When using a shared build, the QML plugin and relevant  QML  files  are
1904       copied  to  the  target’s RUNTIME_OUTPUT_DIRECTORY to make it easier to
1905       run things directly from the build directory.
1906
1907       Example usage:
1908
1909          ecm_add_qml_module(ExampleModule URI "org.example.Example" VERSION 1.4)
1910
1911          target_sources(ExampleModule PRIVATE ExamplePlugin.cpp)
1912          target_link_libraries(ExampleModule PRIVATE Qt::Quick)
1913
1914          ecm_target_qml_sources(ExampleModule SOURCES ExampleItem.qml)
1915          ecm_target_qml_sources(ExampleModule SOURCES AnotherExampleItem.qml VERSION 1.5)
1916
1917          ecm_finalize_qml_module(ExampleModule DESTINATION ${KDE_INSTALL_QMLDIR})
1918
1919          ecm_add_qml_module(<target name> URI <module uri> [VERSION <module version>] [NO_PLUGIN] [CLASSNAME <class name>])
1920
1921       This will declare a new CMake target called <target name>. The URI  ar‐
1922       gument  is  required  and should be a proper QML module URI. The URI is
1923       used, among others, to generate a subdirectory where the module will be
1924       installed to.
1925
1926       If  the VERSION argument is specified, it is used to initialize the de‐
1927       fault version that is used by  ecm_target_qml_sources when  adding  QML
1928       files. If it is not specified, a  default of 1.0 is used. Additionally,
1929       if a version greater than or equal to 2.0 is specified, the major  ver‐
1930       sion is appended to the installation path of the module.
1931
1932       If  the  option  NO_PLUGIN is set, a target is declared that is not ex‐
1933       pected to contain any C++ QML plugin.
1934
1935       If the optional CLASSNAME argument is supplied,  it  will  be  used  as
1936       class  name  in  the generated QMLDIR file. If it is not specified, the
1937       target name will be used instead.
1938
1939       You can add C++ and QML source files to the target using target_sources
1940       and ecm_target_qml_sources, respectively.
1941
1942       Since 5.91.0
1943
1944          ecm_add_qml_module_dependencies(<target> DEPENDS <module string> [<module string> ...])
1945
1946       Add  the  list  of dependencies specified by the DEPENDS argument to be
1947       listed as dependencies in the generated QMLDIR file of <target>.
1948
1949       Since 5.91.0
1950
1951          ecm_target_qml_sources(<target> SOURCES <source.qml> [<source.qml> ...] [VERSION <version>] [PATH <path>] [PRIVATE])
1952
1953       Add the list of QML files specified by the SOURCES argument  as  source
1954       files to the QML module target <target>.
1955
1956       If  the  optional  VERSION argument is specified, all QML files will be
1957       added with the specified version. If it is not specified, they will use
1958       the version of the QML module target.
1959
1960       If  the  optional  PRIVATE argument is specified, the QML files will be
1961       included in the target but not in the generated qmldir file.  Any  ver‐
1962       sion argument will be ignored.
1963
1964       The  optional PATH argument declares a subdirectory of the module where
1965       the files should be copied to. By default, files will be copied to  the
1966       module root.
1967
1968       This  function  will fail if <target> is not a QML module target or any
1969       of the specified files do not exist.
1970
1971       Since 5.91.0
1972
1973          ecm_finalize_qml_module(<target> DESTINATION <QML install destination>)
1974
1975       Finalize the specified QML module target. This must be called after all
1976       other  setup (like adding sources) on the target has been done. It will
1977       perform a number of tasks:
1978
1979       • It will generate a qmldir file from the QML files added to  the  tar‐
1980         get.  If  the  module has a C++ plugin, this will also be included in
1981         the qmldir file.
1982
1983       • If BUILD_SHARED_LIBS is off, a QRC file is  generated  from  the  QML
1984         files  added  to the target. This QRC file will be included when com‐
1985         piling the C++ QML module. The built static library will be installed
1986         in  a subdirection of DESTINATION based on the QML module’s uri. Note
1987         that if NO_PLUGIN is set, a C++ QML plugin will be generated  to  in‐
1988         clude the QRC files.
1989
1990       • If  BUILD_SHARED_LIBS in on, all generated files, QML sources and the
1991         C++ plugin will be installed in a subdirectory of  DESTINATION  based
1992         upon  the  QML  module’s  uri.  In addition, these files will also be
1993         copied to the target’s RUNTIME_OUTPUT_DIRECTORY in a  similar  subdi‐
1994         rectory.
1995
1996       This function will fail if <target> is not a QML module target.
1997
1998       Since 5.91.0
1999
2000   ECMQtDeclareLoggingCategory
2001       This  module  provides the ecm_qt_declare_logging_category function for
2002       generating  declarations  for  logging  categories  in  Qt5,  and   the
2003       ecm_qt_install_logging_categories   function  for  generating  and  in‐
2004       stalling a file in KDebugSettings format with the info about all  those
2005       categories, as well as a file with info about any renamed categories if
2006       defined.  To include in that file any logging categories that are manu‐
2007       ally  defined  also  a  function ecm_qt_export_logging_category is pro‐
2008       vided.
2009
2010          ecm_qt_declare_logging_category(<sources_var_name(|target (since 5.80))>
2011              HEADER <filename>
2012              IDENTIFIER <identifier>
2013              CATEGORY_NAME <category_name>
2014              [OLD_CATEGORY_NAMES <oldest_cat_name> [<second_oldest_cat_name> [...]]]
2015              [DEFAULT_SEVERITY <Debug|Info|Warning|Critical|Fatal>]
2016              [EXPORT <exportid>]
2017              [DESCRIPTION <description>]
2018          )
2019
2020       A header file, <filename>, will be generated along with a corresponding
2021       source file. These will provide a QLoggingCategory category that can be
2022       referred to from C++ code using <identifier>, and from the logging con‐
2023       figuration using <category_name>.
2024
2025       The  generated  source file will be added to the variable with the name
2026       <sources_var_name>. If the given argument is a target  though,  instead
2027       both  the  generated  header file and the generated source file will be
2028       added to the target as private sources (since 5.80).  The  target  must
2029       not be an alias.
2030
2031       If <filename> is not absolute, it will be taken relative to the current
2032       binary directory.
2033
2034       <identifier> may include namespaces (eg: foo::bar::IDENT).
2035
2036       If EXPORT is passed, the category will be registered for the  group  id
2037       <exportid>.  Info about the categories of that group can then be gener‐
2038       ated in a file and installed by  that  group  id  with  the  ecm_qt_in‐
2039       stall_logging_categories  function.  In that case also DESCRIPTION will
2040       need to be passed, with <description> being a short single  line  text.
2041       And OLD_CATEGORY_NAMES can be used to inform about any renamings of the
2042       category, so user settings can be migrated. Since 5.68.0.
2043
2044       Since 5.14.0.
2045
2046          ecm_qt_export_logging_category(
2047              IDENTIFIER <identifier>
2048              CATEGORY_NAME <category_name>
2049              [OLD_CATEGORY_NAMES <oldest_category_name> [<second_oldest_category_name> [...]]]
2050              EXPORT <exportid>
2051              DESCRIPTION <description>
2052              [DEFAULT_SEVERITY <Debug|Info|Warning|Critical|Fatal>]
2053          )
2054
2055       Registers a logging category for being included in  the  generated  and
2056       installed  KDebugSettings  files. To be used for categories who are de‐
2057       clared by manual code or other ways  instead  of  code  generated  with
2058       ecm_qt_declare_logging_category.
2059
2060       <identifier> may include namespaces (eg: foo::bar::IDENT).
2061
2062       EXPORT  specifies  the  group id with which the category will be regis‐
2063       tered.  Info about the categories of that group can then  be  generated
2064       in  a  file and installed by that group id with the ecm_qt_install_log‐
2065       ging_categories function.
2066
2067       DESCRIPTION specifies a short single line text describing the category.
2068
2069       OLD_CATEGORY_NAMES can be used to inform about  any  renamings  of  the
2070       category, so user settings can be migrated.
2071
2072       Since 5.68.0.
2073
2074          ecm_qt_install_logging_categories(
2075              EXPORT <exportid>
2076              [FILE <filename>]
2077              DESTINATION <install_path>
2078              [SORT]
2079              [COMPONENT <component>]
2080          )
2081
2082       Generates  and  installs  a file in KDebugSettings format with the info
2083       about all the categories registered for the group <exportid>,  as  well
2084       as a file with info about any renamed categories, if there are.
2085
2086       The method call needs to be after the last ecm_qt_declare_logging_cate‐
2087       gory call which uses the same <exportid>. This can be in the  same  di‐
2088       rectory, or any subdirectory or parent directory.
2089
2090       EXPORT specifies the group id of categories whose information should be
2091       stored in the file generated and installed.
2092
2093       FILE specifies the name of the file generated and  installed.  It  will
2094       default to lower-cased <exportid>.categories.
2095
2096       DESTINATION specifies where the generated file will be installed.
2097
2098       IF SORT is set, entries will be sorted by identifiers.
2099
2100       COMPONENT  specifies the installation component name with which the in‐
2101       stall rules for the generated file are associated.
2102
2103       Since 5.85.0 this is a no-op when building for Android,  as  KDebugSet‐
2104       tings  is not available on that platform and the logging category files
2105       therefore just bloat the APK.
2106
2107       Example usage:
2108
2109          ecm_qt_declare_logging_category(
2110              MYPROJECT_SRCS
2111              HEADER "myproject_debug.h"
2112              IDENTIFIER "MYPROJECT_DEBUG"
2113              CATEGORY_NAME "myproject"
2114              OLD_CATEGORY_NAMES "myprojectlog"
2115              DESCRIPTION "My project"
2116              EXPORT MyProject
2117          )
2118
2119          ecm_qt_export_logging_category(
2120              IDENTIFIER "MYPROJECT_SUBMODULE_DEBUG"
2121              CATEGORY_NAME "myproject.submodule"
2122              DESCRIPTION "My project - submodule"
2123              EXPORT MyProject
2124          )
2125
2126          ecm_qt_install_logging_categories(
2127              EXPORT MyProject
2128              FILE myproject.categories
2129              DESTINATION "${KDE_INSTALL_LOGGINGCATEGORIESDIR}"
2130          )
2131
2132       Since 5.68.0.
2133
2134   ECMQueryQt
2135       This module can be used to query the installation paths used by Qt.
2136
2137       For Qt5 this uses qmake, and for Qt6 this used qtpaths (the latter  has
2138       built-in  support  to  query  the  paths  of  a  target  platform  when
2139       cross-compiling).
2140
2141       This module defines the following function:
2142
2143          ecm_query_qt(<result_variable> <qt_variable> [TRY])
2144
2145       Passing TRY will result in the method not making the build fail if  the
2146       executable  used  for  querying  has not been found, but instead simply
2147       print a warning message and return an empty string.
2148
2149       Example usage:
2150
2151          include(ECMQueryQt)
2152          ecm_query_qt(bin_dir QT_INSTALL_BINS)
2153
2154       If the call succeeds ${bin_dir} will be set to <prefix>/path/to/bin/dir
2155       (e.g.  /usr/lib64/qt/bin/).
2156
2157       Since: 5.93
2158
2159   ECMSetupQtPluginMacroNames
2160       Instruct  CMake’s  automoc about C++ preprocessor macros used to define
2161       Qt-style plugins.
2162
2163          ecm_setup_qtplugin_macro_names(
2164              [JSON_NONE <macro_name> [<macro_name> [...]]]
2165              [JSON_ARG1 <macro_name> [<macro_name> [...]]]
2166              [JSON_ARG2 <macro_name> [<macro_name> [...]]]
2167              [JSON_ARG3 <macro_name> [<macro_name> [...]]]
2168              [CONFIG_CODE_VARIABLE <variable_name>] )
2169
2170       CMake’s automoc needs some support when parsing C++ source files to de‐
2171       tect whether moc should be run on those files and if there are also de‐
2172       pendencies on other files, like those with Qt plugin metadata  in  JSON
2173       format.  Because  automoc  just  greps  overs the raw plain text of the
2174       sources without any C++ preprocessor-like processing.  CMake  in  newer
2175       versions  provides the variables CMAKE_AUTOMOC_DEPEND_FILTERS (CMake >=
2176       3.9.0) and CMAKE_AUTOMOC_MACRO_NAMES (CMake >= 3.10) to allow  the  de‐
2177       veloper to assist automoc.
2178
2179       This  macro cares for the explicit setup needed for those variables for
2180       common cases of C++ preprocessor macros used for Qt-style plugins.
2181
2182       JSON_NONE lists the names of C++ preprocessor macros for Qt-style plug‐
2183       ins which do not refer to external files with the plugin metadata.
2184
2185       JSON_ARG1 lists the names of C++ preprocessor macros for Qt-style plug‐
2186       ins where the first argument to the macro is the name of  the  external
2187       file with the plugin metadata.
2188
2189       JSON_ARG2  is  the  same  as JSON_ARG1 but with the file name being the
2190       second argument.
2191
2192       JSON_ARG3 is the same as JSON_ARG1 but with the  file  name  being  the
2193       third argument.
2194
2195       CONFIG_CODE_VARIABLE  specifies the name of the variable which will get
2196       set as value some generated CMake code for instructing automoc for  the
2197       given  macro  names,  as  useful in an installed CMake config file. The
2198       variable can then be used as usual in the  template  file  for  such  a
2199       CMake config file, by @<variable_name>@.
2200
2201       Example usage:
2202
2203       Given some plugin-oriented Qt-based software which defines a custom C++
2204       preprocessor macro EXPORT_MYPLUGIN for declaring the central plugin ob‐
2205       ject:
2206
2207          #define EXPORT_MYPLUGIN_WITH_JSON(classname, jsonFile) \
2208          class classname : public QObject \
2209          { \
2210              Q_OBJECT \
2211              Q_PLUGIN_METADATA(IID "myplugin" FILE jsonFile) \
2212              explicit classname() {} \
2213          };
2214
2215       In the CMake buildsystem of the library one calls
2216
2217          ecm_setup_qtplugin_macro_names(
2218              JSON_ARG2
2219                 EXPORT_MYPLUGIN_WITH_JSON
2220          )
2221
2222       to instruct automoc about the usage of that macro in the sources of the
2223       library itself.
2224
2225       Given the software installs a library including  the  header  with  the
2226       macro definition and a CMake config file, so 3rd-party can create addi‐
2227       tional plugins by linking against the library, one passes  additionally
2228       the  name  of  a  variable  which  shall be set as value the CMake code
2229       needed to instruct automoc about the usage of that macro.
2230
2231          ecm_setup_qtplugin_macro_names(
2232              JSON_ARG2
2233                 EXPORT_MYPLUGIN_WITH_JSON
2234              CONFIG_CODE_VARIABLE
2235                 PACKAGE_SETUP_AUTOMOC_VARIABLES
2236          )
2237
2238       This variable then is used in the template  file  (e.g.   MyProjectCon‐
2239       fig.cmake.in) for the libary’s installed CMake config file and that way
2240       will ensure that in the 3rd-party plugin’s buildsystem automoc  is  in‐
2241       structed as well as needed:
2242
2243          @PACKAGE_SETUP_AUTOMOC_VARIABLES@
2244
2245       Since 5.45.0.
2246
2247   ECMSetupVersion
2248       Handle library version information.
2249
2250          ecm_setup_version(<version>
2251                            VARIABLE_PREFIX <prefix>
2252                            [SOVERSION <soversion>]
2253                            [VERSION_HEADER <filename>]
2254                            [PACKAGE_VERSION_FILE <filename> [COMPATIBILITY <compat>]] )
2255
2256       This  parses  a  version  string  and sets up a standard set of version
2257       variables.  It can optionally also create a C version header file and a
2258       CMake package version file to install along with the library.
2259
2260       If  the  <version>  argument is of the form <major>.<minor>.<patch> (or
2261       <major>.<minor>.<patch>.<tweak>), The  following  CMake  variables  are
2262       set:
2263
2264          <prefix>_VERSION_MAJOR  - <major>
2265          <prefix>_VERSION_MINOR  - <minor>
2266          <prefix>_VERSION_PATCH  - <patch>
2267          <prefix>_VERSION        - <version>
2268          <prefix>_SOVERSION      - <soversion>, or <major> if SOVERSION was not given
2269
2270       For backward-compatibility also this variable is set (only if the mini‐
2271       mum required version of ECM is < 5.83):
2272
2273          <prefix>_VERSION_STRING - <version> (use <prefix>_VERSION instead)
2274
2275       If CMake policy CMP0048 is not NEW, the following CMake variables  will
2276       also be set:
2277
2278          PROJECT_VERSION_MAJOR   - <major>
2279          PROJECT_VERSION_MINOR   - <minor>
2280          PROJECT_VERSION_PATCH   - <patch>
2281          PROJECT_VERSION         - <version>
2282
2283       For  backward-compatibility,  if  CMake policy CMP0048 is not NEW, also
2284       this variable is set (only if the minimum required version of ECM is  <
2285       5.83):
2286
2287          PROJECT_VERSION_STRING  - <version> (use PROJECT_VERSION instead)
2288
2289       If  the  VERSION_HEADER  option is used, a simple C header is generated
2290       with the given filename. If filename is a relative path, it  is  inter‐
2291       preted  as  relative to CMAKE_CURRENT_BINARY_DIR.  The generated header
2292       contains the following macros:
2293
2294          <prefix>_VERSION_MAJOR  - <major> as an integer
2295          <prefix>_VERSION_MINOR  - <minor> as an integer
2296          <prefix>_VERSION_PATCH  - <patch> as an integer
2297          <prefix>_VERSION_STRING - <version> as a C string
2298          <prefix>_VERSION        - the version as an integer
2299
2300       <prefix>_VERSION has <patch> in the bottom 8 bits, <minor> in the  next
2301       8  bits  and <major> in the remaining bits.  Note that <patch> and <mi‐
2302       nor> must be less than 256.
2303
2304       If the PACKAGE_VERSION_FILE option is used, a simple CMake package ver‐
2305       sion file is created using the write_basic_package_version_file() macro
2306       provided by CMake. It should be installed in the same location  as  the
2307       Config.cmake  file of the library so that it can be found by find_pack‐
2308       age().  If the filename is a relative path, it is interpreted as  rela‐
2309       tive  to CMAKE_CURRENT_BINARY_DIR. The optional COMPATIBILITY option is
2310       forwarded  to  write_basic_package_version_file(),  and   defaults   to
2311       AnyNewerVersion.
2312
2313       If  CMake  policy CMP0048 is NEW, an alternative form of the command is
2314       available:
2315
2316          ecm_setup_version(PROJECT
2317                            [VARIABLE_PREFIX <prefix>]
2318                            [SOVERSION <soversion>]
2319                            [VERSION_HEADER <filename>]
2320                            [PACKAGE_VERSION_FILE <filename>] )
2321
2322       This will use the version information set  by  the  project()  command.
2323       VARIABLE_PREFIX  defaults  to the project name.  Note that PROJECT must
2324       be the first argument.  In all other  respects,  it  behaves  like  the
2325       other form of the command.
2326
2327       Since pre-1.0.0.
2328
2329       COMPATIBILITY option available since 1.6.0.
2330
2331   ECMSourceVersionControl
2332       Tries  to  determine  whether  the source is under version control (git
2333       clone, svn checkout, etc).
2334
2335       ECM_SOURCE_UNDER_VERSION_CONTROL is set when indication is  found  that
2336       CMAKE_SOURCE_DIR is under version control.
2337
2338       Since 5.63
2339
2340   ECMUninstallTarget
2341       Add an uninstall target.
2342
2343       By  including  this  module,  an uninstall target will be added to your
2344       CMake project. This will remove all files installed (or updated)  by  a
2345       previous  invocation  of  the  install target. It will not remove files
2346       created or modified by an install(SCRIPT) or install(CODE) command; you
2347       should  create a custom uninstallation target for these and use add_de‐
2348       pendency to make the uninstall target depend on it:
2349
2350          include(ECMUninstallTarget)
2351          install(SCRIPT install-foo.cmake)
2352          add_custom_target(uninstall_foo COMMAND ${CMAKE_COMMAND} -P uninstall-foo.cmake)
2353          add_dependency(uninstall uninstall_foo)
2354
2355       The target will fail if the install target has not yet been run (so  it
2356       is  not  possible  to run CMake on the project and then immediately run
2357       the uninstall target).
2358
2359       WARNING:
2360          CMake deliberately does not provide an uninstall target  by  default
2361          on  the  basis that such a target has the potential to remove impor‐
2362          tant files from a user’s computer. Use with caution.
2363
2364       Since 1.7.0.
2365
2366   ECMUseFindModules
2367       Selectively use some of the find modules provided  by  extra-cmake-mod‐
2368       ules.
2369
2370       This  module  is  automatically  available once extra-cmake-modules has
2371       been found, so it is not necessary  to  include(ECMUseFindModules)  ex‐
2372       plicitly.
2373
2374          ecm_use_find_modules(DIR <dir>
2375                               MODULES module1.cmake [module2.cmake [...]]
2376                               [NO_OVERRIDE])
2377
2378       This  allows selective use of the find modules provided by ECM, includ‐
2379       ing deferring to CMake’s versions of those  modules  if  it  has  them.
2380       Rather than adding ${ECM_FIND_MODULE_DIR} to CMAKE_MODULE_PATH, you use
2381       ecm_use_find_modules() to copy the modules you want to a local  (build)
2382       directory, and add that to CMAKE_MODULE_PATH.
2383
2384       The find modules given to MODULES will be copied to the directory given
2385       by DIR (which should be located in  ${CMAKE_BINARY_DIR}  and  added  to
2386       CMAKE_MODULE_PATH).   If  NO_OVERRIDE  is  given, only modules not also
2387       provided by CMake will be copied.
2388
2389       Example:
2390
2391          find_package(ECM REQUIRED)
2392          ecm_use_find_modules(
2393              DIR ${CMAKE_BINARY_DIR}/cmake
2394              MODULES FindEGL.cmake
2395              NO_OVERRIDE
2396          )
2397          set(CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR}/cmake)
2398
2399       This example will make FindEGL.cmake available  in  your  project,  but
2400       only as long as it is not yet part of CMake. Calls to find_package(EGL)
2401       will then make use of this copied module (or the CMake module if it ex‐
2402       ists).
2403
2404       Another  possible  use for this macro is to take copies of find modules
2405       that can be installed along with config files if they are required as a
2406       dependency  (for example, if targets provided by the find module are in
2407       the link interface of a library).
2408
2409       Since pre-1.0.0.
2410
2411   ECMWinResolveSymlinks
2412       Resolve pseudo-symlinks created by git when cloning on Windows.
2413
2414          ecm_win_resolve_symlinks(<dir>)
2415
2416       When git checks out a repository with UNIX symlinks on Windows machine,
2417       it  creates a text file for each symlink, containing a relative path to
2418       the real file.  This function would recursively walk over specified di‐
2419       rectory and replace pseudo-symlinks with corresponding real file’s con‐
2420       tents. It would then run git update-index --assume-unchanged on them to
2421       trick git.
2422
2423       This is useful for projects like “breeze-icons” that contain many iden‐
2424       tical icons implemented as symlinks.
2425
2426       Since 5.28
2427
2428   QtVersionOption
2429       Adds a build option to select the major Qt version if  necessary,  that
2430       is, if the major Qt version has not yet been determined otherwise (e.g.
2431       by a corresponding find_package() call).  This module is typically  in‐
2432       cluded by other modules requiring knowledge about the major Qt version.
2433
2434       QT_MAJOR_VERSION is defined to either be “5” or “6”.
2435
2436       Since 5.82.0.
2437

SEE ALSO

2439       ecm(7), ecm-find-modules(7), ecm-kde-modules(7)
2440
2442       KDE Developers
2443
2444
2445
2446
24475.96                             Jul 03, 2022                   ECM-MODULES(7)
Impressum