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
13       ecm-find-modules(7);  those that provide standard settings for software
14       produced by the KDE community  are  documented  in  ecm-kde-modules(7).
15       The  rest provide macros and functions for general use by CMake scripts
16       and are documented 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
705          ECMPoQmTools 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.2")
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
834       KDECompilerSettings, so projects using that module do not need to  also
835       include 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       CUSTOM_CONTENT_FROM_VARIABLE specifies the name  of  a  variable  whose
1120       content  will  be appended at the end of the generated file, before any
1121       final inclusion guard closing. Note that before 5.98  this  was  broken
1122       and would only append the string passed as argument value.
1123
1124       The function ecm_generate_export_header defines C++ preprocessor macros
1125       in the generated export header, some for use in the sources of the  li‐
1126       brary  the  header  is generated for, other for use by projects linking
1127       agsinst the library.
1128
1129       The macros for use in the library C++ sources are these, next to  those
1130       also defined by GenerateExportHeader:
1131
1132       <prefix_name><uppercase_base_name>_DEPRECATED_VERSION(major,     minor,
1133       text)
1134              to   use   to   conditionally   set    a    <prefix_name><upper‐
1135              case_base_name>_DEPRECATED macro for a class, struct or function
1136              (other elements to be supported in future  versions),  depending
1137              on the visibility macro flags set (see below)
1138
1139       <prefix_name><uppercase_base_name>_DEPRECATED_VERSION_BELATED(major,
1140       minor, textmajor, textminor, text)
1141              to   use   to   conditionally   set    a    <prefix_name><upper‐
1142              case_base_name>_DEPRECATED macro for a class, struct or function
1143              (other elements to be supported in future  versions),  depending
1144              on  the visibility macro flags set (see below), with major & mi‐
1145              nor applied for the logic and  textmajor  &  textminor  for  the
1146              warnings message.  Useful for retroactive tagging of API for the
1147              compiler without injecting the API  into  the  compiler  warning
1148              conditions of already released versions.  Since 5.71.
1149
1150       <prefix_name><uppercase_base_name>_ENUMERATOR_DEPRECATED_VERSION(major,
1151       minor, text)
1152              to   use   to   conditionally   set    a    <prefix_name><upper‐
1153              case_base_name>_DEPRECATED macro for an enumerator, depending on
1154              the warnings macro flags set (see below). In builds using  C++14
1155              standard  or  earlier,  where  enumerator attributes are not yet
1156              supported, the macro will always yield an  empty  string.   With
1157              MSVC it is also always an empty string for now.  Since 5.82.
1158
1159       <prefix_name><uppercase_base_name>_ENUMERATOR_DEPRECATED_VERSION_BE‐
1160       LATED(major, minor, textmajor, textminor, text)
1161              to   use   to   conditionally   set    a    <prefix_name><upper‐
1162              case_base_name>_DEPRECATED macro for an enumerator, depending on
1163              the warnings macro flags set (see below), with major & minor ap‐
1164              plied  for  the logic and textmajor & textminor for the warnings
1165              message.  In builds using C++14 standard or earlier, where  enu‐
1166              merator  attributes are not yet supported, the macro will always
1167              yield an empty string.  Useful for retroactive  tagging  of  API
1168              for  the  compiler  without  injecting the API into the compiler
1169              warning conditions of already released versions.  With  MSVC  it
1170              is also always an empty string for now.  Since 5.82.
1171
1172       <prefix_name><uppercase_base_name>_ENABLE_DEPRECATED_SINCE(major,   mi‐
1173       nor)
1174              evaluates to TRUE or FALSE depending  on  the  visibility  macro
1175              flags set (see below). To be used mainly with #if/#endif to mark
1176              sections of code which should be included depending on the visi‐
1177              bility requested.
1178
1179       <prefix_name><uppercase_base_name>_BUILD_DEPRECATED_SINCE(major, minor)
1180              evaluates  to  TRUE  or  FALSE  depending  on  the  value of EX‐
1181              CLUDE_DEPRECATED_BEFORE_AND_AT. To be used mainly with  #if/#en‐
1182              dif  to  mark sections of two types of code: implementation code
1183              for deprecated API and declaration code of deprecated API  which
1184              only may be disabled at build time of the library for BC reasons
1185              (e.g. virtual methods, see notes below).
1186
1187       <prefix_name><uppercase_base_name>_EXCLUDE_DEPRECATED_BEFORE_AND_AT
1188              holds the version used to exclude deprecated API at  build  time
1189              of the library.
1190
1191       The macros used to control visibility when building against the library
1192       are:
1193
1194       <prefix_name><uppercase_base_name>_DISABLE_DEPRECATED_BEFORE_AND_AT
1195              definition to set to a value in single hex number version  nota‐
1196              tion (0x<major><minor><patchlevel>).
1197
1198       <prefix_name><uppercase_base_name>_NO_DEPRECATED
1199              flag  to  define to disable all deprecated API, being a shortcut
1200              for  settings  <prefix_name><uppercase_base_name>_DISABLE_DEPRE‐
1201              CATED_BEFORE_AND_AT  to  the  current  version. If both are set,
1202              this flag overrules.
1203
1204       <prefix_name><uppercase_base_name>_DEPRECATED_WARNINGS_SINCE
1205              definition to set to a value in single hex number version  nota‐
1206              tion (0x<major><minor><patchlevel>). Warnings will be only acti‐
1207              vated for API deprecated up to and  including  the  version.  If
1208              <prefix_name><uppercase_base_name>_DISABLE_DEPRECATED_BE‐
1209              FORE_AND_AT is set (directly or via the group default), it  will
1210              default to that version, resulting in no warnings. Otherwise the
1211              default is the current version, resulting in  warnings  for  all
1212              deprecated API.
1213
1214       <prefix_name><uppercase_base_name>_NO_DEPRECATED_WARNINGS
1215              flag  to  define  to  disable  all deprecation warnings, being a
1216              shortcut for  setting  <prefix_name><uppercase_base_name>_DEPRE‐
1217              CATED_WARNINGS_SINCE  to  “0”.  If both are set, this flag over‐
1218              rules.
1219
1220       When the GROUP_BASE_NAME has been used, the same macros  but  with  the
1221       given  <group_base_name> prefix are available to define the defaults of
1222       these macros, if not explicitly set.
1223
1224       WARNING:
1225          The tricks applied here for hiding deprecated API  to  the  compiler
1226          when building against a library do not work for all deprecated API:
1227
1228          • virtual  methods  need  to  stay  visible to the compiler to build
1229            proper virtual method tables for subclasses
1230
1231          • enumerators from enums cannot be simply removed, as  this  changes
1232            auto  values of following enumerators, also can poke holes in enu‐
1233            merator series used as index into tables
1234
1235          In such cases the API can be only “hidden” at build time of the  li‐
1236          brary,  itself,  by generated hard coded macro settings, using <pre‐
1237          fix_name><uppercase_base_name>_BUILD_DEPRECATED_SINCE(major, minor).
1238
1239       Examples:
1240
1241       Preparing a library “Foo” created by target “foo”, which is part  of  a
1242       group  of  libraries  “Bar”,  where some API of “Foo” got deprecated at
1243       versions 5.0 & 5.12:
1244
1245          ecm_generate_export_header(foo
1246              GROUP_BASE_NAME BAR
1247              VERSION ${FOO_VERSION}
1248              DEPRECATION_VERSIONS 5.0 5.12
1249          )
1250
1251       In the library “Foo” sources in the headers the API would  be  prepared
1252       like  this,  using the generated macros FOO_ENABLE_DEPRECATED_SINCE and
1253       FOO_DEPRECATED_VERSION:
1254
1255          #include <foo_export.h>
1256
1257          #if FOO_ENABLE_DEPRECATED_SINCE(5, 0)
1258          /**
1259            * @deprecated Since 5.0
1260            */
1261          FOO_EXPORT
1262          FOO_DEPRECATED_VERSION(5, 0, "Use doFoo2()")
1263          void doFoo();
1264          #endif
1265
1266          #if FOO_ENABLE_DEPRECATED_SINCE(5, 12)
1267          /**
1268            * @deprecated Since 5.12
1269            */
1270          FOO_EXPORT
1271          FOO_DEPRECATED_VERSION(5, 12, "Use doBar2()")
1272          void doBar();
1273          #endif
1274
1275       Projects linking against the “Foo” library can control  which  part  of
1276       its deprecated API should be hidden to the compiler by adding a defini‐
1277       tion using the FOO_DISABLE_DEPRECATED_BEFORE_AND_AT macro variable  set
1278       to the desired value (in version hex number notation):
1279
1280          add_definitions(-DFOO_DISABLE_DEPRECATED_BEFORE_AND_AT=0x050000)
1281
1282       Or using the macro variable of the group:
1283
1284          add_definitions(-DBAR_DISABLE_DEPRECATED_BEFORE_AND_AT=0x050000)
1285
1286       If  both  are specified, FOO_DISABLE_DEPRECATED_BEFORE_AND_AT will take
1287       precedence.
1288
1289       To build a variant of a library with  some  deprecated  API  completely
1290       left  out  from  the build, not only optionally invisible to consumers,
1291       one uses the EXCLUDE_DEPRECATED_BEFORE_AND_AT parameter. This  is  best
1292       combined with a cached CMake variable.
1293
1294          set(EXCLUDE_DEPRECATED_BEFORE_AND_AT 0 CACHE STRING "Control the range of deprecated API excluded from the build [default=0].")
1295
1296          ecm_generate_export_header(foo
1297              VERSION ${FOO_VERSION}
1298              EXCLUDE_DEPRECATED_BEFORE_AND_AT ${EXCLUDE_DEPRECATED_BEFORE_AND_AT}
1299              DEPRECATION_VERSIONS 5.0 5.12
1300          )
1301
1302       The  macros  used  in  the headers for library consumers are reused for
1303       disabling the API excluded in the build of the library.  For  disabling
1304       the  implementation of that API as well as for disabling deprecated API
1305       which only can be disabled at build time of the library for BC reasons,
1306       one uses the generated macro FOO_BUILD_DEPRECATED_SINCE, like this:
1307
1308          #include <foo_export.h>
1309
1310          enum Bars {
1311              One,
1312          #if FOO_BUILD_DEPRECATED_SINCE(5, 0)
1313              Two FOO_ENUMERATOR_DEPRECATED_VERSION(5, 0, "Use Three"), // macro available since 5.82
1314          #endif
1315              Three,
1316          };
1317
1318          #if FOO_ENABLE_DEPRECATED_SINCE(5, 0)
1319          /**
1320            * @deprecated Since 5.0
1321            */
1322          FOO_EXPORT
1323          FOO_DEPRECATED_VERSION(5, 0, "Use doFoo2()")
1324          void doFoo();
1325          #endif
1326
1327          #if FOO_ENABLE_DEPRECATED_SINCE(5, 12)
1328          /**
1329            * @deprecated Since 5.12
1330            */
1331          FOO_EXPORT
1332          FOO_DEPRECATED_VERSION(5, 12, "Use doBar2()")
1333          void doBar();
1334          #endif
1335
1336          class FOO_EXPORT Foo {
1337          public:
1338          #if FOO_BUILD_DEPRECATED_SINCE(5, 0)
1339              /**
1340                * @deprecated Since 5.0
1341                */
1342              FOO_DEPRECATED_VERSION(5, 0, "Feature removed")
1343              virtual void doWhat();
1344          #endif
1345          };
1346
1347          #if FOO_BUILD_DEPRECATED_SINCE(5, 0)
1348          void doFoo()
1349          {
1350              // [...]
1351          }
1352          #endif
1353
1354          #if FOO_BUILD_DEPRECATED_SINCE(5, 12)
1355          void doBar()
1356          {
1357              // [...]
1358          }
1359          #endif
1360
1361          #if FOO_BUILD_DEPRECATED_SINCE(5, 0)
1362          void Foo::doWhat()
1363          {
1364              // [...]
1365          }
1366          #endif
1367
1368       So e.g. if EXCLUDE_DEPRECATED_BEFORE_AND_AT is set to “5.0.0”, the enu‐
1369       merator Two as well as the methods ::doFoo() and Foo::doWhat() will  be
1370       not available to library consumers. The methods will not have been com‐
1371       piled into the library binary, and the declarations will be  hidden  to
1372       the  compiler, FOO_DISABLE_DEPRECATED_BEFORE_AND_AT also cannot be used
1373       to reactivate them.
1374
1375       When using the NO_DEFINITION_EXPORT_TO_BUILD_INTERFACE and the  project
1376       for  the “Foo” library includes also tests and examples linking against
1377       the library and using deprecated API (like tests covering it), one bet‐
1378       ter explicitly sets FOO_DISABLE_DEPRECATED_BEFORE_AND_AT for those tar‐
1379       gets to the version before and at which all deprecated API has been ex‐
1380       cluded from the build.  Even more when building against other libraries
1381       from the same group “Bar” and disabling some deprecated  API  of  those
1382       libraries  using  the group macro BAR_DISABLE_DEPRECATED_BEFORE_AND_AT,
1383       which also works as default for FOO_DISABLE_DEPRECATED_BEFORE_AND_AT.
1384
1385       To  get  the  hex  number  style  value  the   helper   macro   ecm_ex‐
1386       port_header_format_version() will be used:
1387
1388          set(EXCLUDE_DEPRECATED_BEFORE_AND_AT 0 CACHE STRING "Control what part of deprecated API is excluded from build [default=0].")
1389
1390          ecm_generate_export_header(foo
1391              VERSION ${FOO_VERSION}
1392              GROUP_BASE_NAME BAR
1393              EXCLUDE_DEPRECATED_BEFORE_AND_AT ${EXCLUDE_DEPRECATED_BEFORE_AND_AT}
1394              NO_DEFINITION_EXPORT_TO_BUILD_INTERFACE
1395              DEPRECATION_VERSIONS 5.0 5.12
1396          )
1397
1398          ecm_export_header_format_version(${EXCLUDE_DEPRECATED_BEFORE_AND_AT}
1399              CURRENT_VERSION ${FOO_VERSION}
1400              HEXNUMBER_VAR foo_no_deprecated_before_and_at
1401          )
1402
1403          # disable all deprecated API up to 5.9.0 from all other libs of group "BAR" that we use ourselves
1404          add_definitions(-DBAR_DISABLE_DEPRECATED_BEFORE_AND_AT=0x050900)
1405
1406          add_executable(app app.cpp)
1407          target_link_libraries(app foo)
1408          target_compile_definitions(app
1409               PRIVATE "FOO_DISABLE_DEPRECATED_BEFORE_AND_AT=${foo_no_deprecated_before_and_at}")
1410
1411       Since 5.64.0.
1412
1413   ECMGenerateHeaders
1414       Generate C/C++ CamelCase forwarding headers.
1415
1416          ecm_generate_headers(<camelcase_forwarding_headers_var>
1417              HEADER_NAMES <CamelCaseName> [<CamelCaseName> [...]]
1418              [ORIGINAL <CAMELCASE|LOWERCASE>]
1419              [HEADER_EXTENSION <header_extension>]
1420              [OUTPUT_DIR <output_dir>]
1421              [PREFIX <prefix>]
1422              [REQUIRED_HEADERS <variable>]
1423              [COMMON_HEADER <HeaderName>]
1424              [RELATIVE <relative_path>])
1425
1426       For  each  CamelCase header name passed to HEADER_NAMES, a file of that
1427       name will be generated that will include a version with .h or, if  set,
1428       .<header_extension> appended.  For example, the generated header ClassA
1429       will include classa.h (or ClassA.h, see ORIGINAL).  If a  CamelCaseName
1430       consists of multiple comma-separated files, e.g.  ClassA,ClassB,ClassC,
1431       then multiple camelcase header files will be generated which are  redi‐
1432       rects  to the first header file.  The file locations of these generated
1433       headers will be stored in <camelcase_forwarding_headers_var>.
1434
1435       ORIGINAL specifies how the name of the original header is written: low‐
1436       ercased or also camelcased.  The default is “LOWERCASE”. Since 1.8.0.
1437
1438       HEADER_EXTENSION  specifies  what  file  name extension is used for the
1439       header files.  The default is “h”. Since 5.48.0.
1440
1441       PREFIX places the generated headers in subdirectories.  This should  be
1442       a CamelCase name like KParts, which will cause the CamelCase forwarding
1443       headers to be placed in the KParts directory  (e.g.  KParts/Part).   It
1444       will also, for the convenience of code in the source distribution, gen‐
1445       erate  forwarding  headers  based   on   the   original   names   (e.g.
1446       kparts/part.h).   This  allows includes like "#include <kparts/part.h>"
1447       to be used before installation, as long as the include_directories  are
1448       set appropriately.
1449
1450       OUTPUT_DIR  specifies where the files will be generated; this should be
1451       within the build  directory.  By  default,  ${CMAKE_CURRENT_BINARY_DIR}
1452       will be used.  This option can be used to avoid file conflicts.
1453
1454       REQUIRED_HEADERS  specifies  an  output variable name where all the re‐
1455       quired headers will be appended so that they can be installed  together
1456       with  the  generated ones.  This is mostly intended as a convenience so
1457       that adding a new header to a  project  only  requires  specifying  the
1458       CamelCase variant in the CMakeLists.txt file; the original variant will
1459       then be added to this variable.
1460
1461       COMMON_HEADER generates an additional convenience header which includes
1462       all other header files.
1463
1464       The RELATIVE argument indicates where the original headers can be found
1465       relative to CMAKE_CURRENT_SOURCE_DIR.  It does not affect the generated
1466       CamelCase  forwarding  files,  but  ecm_generate_headers() uses it when
1467       checking that the original header exists, and  to  generate  originally
1468       named forwarding headers when PREFIX is set.
1469
1470       To  allow other parts of the source distribution (eg: tests) to use the
1471       generated headers before installation, it may be desirable to  set  the
1472       INCLUDE_DIRECTORIES property for the library target to output_dir.  For
1473       example, if OUTPUT_DIR is CMAKE_CURRENT_BINARY_DIR (the  default),  you
1474       could do
1475
1476          target_include_directories(MyLib PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>")
1477
1478       Example usage (without PREFIX):
1479
1480          ecm_generate_headers(
1481              MyLib_FORWARDING_HEADERS
1482              HEADERS
1483                  MLFoo
1484                  MLBar
1485                  # etc
1486              REQUIRED_HEADERS MyLib_HEADERS
1487              COMMON_HEADER MLGeneral
1488          )
1489          install(FILES ${MyLib_FORWARDING_HEADERS} ${MyLib_HEADERS}
1490                  DESTINATION ${CMAKE_INSTALL_PREFIX}/include
1491                  COMPONENT Devel)
1492
1493       Example usage (with PREFIX):
1494
1495          ecm_generate_headers(
1496              MyLib_FORWARDING_HEADERS
1497              HEADERS
1498                  Foo
1499                  # several classes are contained in bar.h, so generate
1500                  # additional files
1501                  Bar,BarList
1502                  # etc
1503              PREFIX MyLib
1504              REQUIRED_HEADERS MyLib_HEADERS
1505          )
1506          install(FILES ${MyLib_FORWARDING_HEADERS}
1507                  DESTINATION ${CMAKE_INSTALL_PREFIX}/include/MyLib
1508                  COMPONENT Devel)
1509          install(FILES ${MyLib_HEADERS}
1510                  DESTINATION ${CMAKE_INSTALL_PREFIX}/include/mylib
1511                  COMPONENT Devel)
1512
1513       Since pre-1.0.0.
1514
1515   ECMGeneratePkgConfigFile
1516       Generate a pkg-config file for the benefit of autotools-based projects.
1517
1518          ecm_generate_pkgconfig_file(BASE_NAME <baseName>
1519                                [LIB_NAME <libName>]
1520                                [DEPS [PRIVATE|PUBLIC] <dep> [[PRIVATE|PUBLIC] <dep> [...]]]
1521                                [FILENAME_VAR <filename_variable>]
1522                                [INCLUDE_INSTALL_DIR <dir>]
1523                                [LIB_INSTALL_DIR <dir>]
1524                                [DEFINES -D<variable=value>...]
1525                                [DESCRIPTION <library description>] # since 5.41.0
1526                                [URL <url>] # since 5.89.0
1527                                [INSTALL])
1528
1529       BASE_NAME is the name of the module. It’s the name projects will use to
1530       find the module.
1531
1532       LIB_NAME is the name of the library that is being  exported.  If  unde‐
1533       fined,  it  will default to the BASE_NAME. That means the LIB_NAME will
1534       be set as the name field as well as the library to link to.
1535
1536       DEPS is the list of libraries required by this library. Libraries  that
1537       are  not exposed to applications should be marked with PRIVATE. The de‐
1538       fault is PUBLIC, but note that according to  the  Guide  to  pkg-config
1539       marking  dependencies  as  private is usually preferred. The PUBLIC and
1540       PRIVATE keywords are supported since 5.89.0.
1541
1542       FILENAME_VAR is specified with a variable name. This variable will  re‐
1543       ceive  the location of the generated file will be set, within the build
1544       directory. This way it can be used in case some processing is required.
1545       See also INSTALL.
1546
1547       INCLUDE_INSTALL_DIR  specifies where the includes will be installed. If
1548       it’s not specified, it will default  to  INSTALL_INCLUDEDIR,  CMAKE_IN‐
1549       STALL_INCLUDEDIR  or  just  “include/” in case they are specified, with
1550       the BASE_NAME postfixed.
1551
1552       LIB_INSTALL_DIR specifies where the library is being installed. If it’s
1553       not specified, it will default to LIB_INSTALL_DIR, CMAKE_INSTALL_LIBDIR
1554       or just “lib/” in case they are specified.
1555
1556       DEFINES is a list of preprocessor defines that it is recommended  users
1557       of the library pass to the compiler when using it.
1558
1559       DESCRIPTION  describes  what  this  library  is. If it’s not specified,
1560       CMake will first try to get the description from the metainfo.yaml file
1561       or will create one based on LIB_NAME. Since 5.41.0.
1562
1563       URL An URL where people can get more information about and download the
1564       package. Defaults to “https://www.kde.org/”. Since 5.89.0.
1565
1566       INSTALL will cause the module to be installed to the  pkgconfig  subdi‐
1567       rectory  of LIB_INSTALL_DIR, unless the ECM_PKGCONFIG_INSTALL_DIR cache
1568       variable is set to something different.
1569
1570       NOTE:
1571          The first call to ecm_generate_pkgconfig_file() with the INSTALL ar‐
1572          gument  will cause ECM_PKGCONFIG_INSTALL_DIR to be set to the cache,
1573          and will be used in any subsequent calls.
1574
1575       To properly use this macro a version needs to be set. To  retrieve  it,
1576       ECM_PKGCONFIG_INSTALL_DIR  uses  PROJECT_VERSION.  To  set  it, use the
1577       project() command or the ecm_setup_version() macro
1578
1579       Example usage:
1580
1581          ecm_generate_pkgconfig_file(
1582              BASE_NAME KF5Archive
1583              DEPS Qt5Core
1584              FILENAME_VAR pkgconfig_filename
1585              INSTALL
1586          )
1587
1588       Since 1.3.0.
1589
1590   ECMGeneratePriFile
1591       Generate a .pri file for the benefit of qmake-based projects.
1592
1593       As well as the function below, this module creates the  cache  variable
1594       ECM_MKSPECS_INSTALL_DIR  and sets the default value to mkspecs/modules.
1595       This assumes Qt and the current project are both installed to the  same
1596       non-system  prefix.  Packagers who use -DCMAKE_INSTALL_PREFIX=/usr will
1597       certainly  want  to  set  ECM_MKSPECS_INSTALL_DIR  to  something   like
1598       share/qt5/mkspecs/modules.
1599
1600       The  main  thing is that this should be the modules subdirectory of ei‐
1601       ther the default qmake mkspecs directory or of a directory that will be
1602       in the $QMAKEPATH environment variable when qmake is run.
1603
1604          ecm_generate_pri_file(BASE_NAME <baseName>
1605                                LIB_NAME <libName>
1606                                [VERSION <version>] # since 5.83
1607                                [DEPS "<dep> [<dep> [...]]"]
1608                                [FILENAME_VAR <filename_variable>]
1609                                [INCLUDE_INSTALL_DIRS <dir> [<dir> [...]]]  # since 5.92
1610                                [INCLUDE_INSTALL_DIR <dir>] # deprecated since 5.92
1611                                [LIB_INSTALL_DIR <dir>])
1612
1613       If your CMake project produces a Qt-based library, you may expect there
1614       to be applications that wish to use it that  use  a  qmake-based  build
1615       system,  rather than a CMake-based one.  Creating a .pri file will make
1616       use of your library convenient for them, in  much  the  same  way  that
1617       CMake config files make things convenient for CMake-based applications.
1618       ecm_generate_pri_file() generates just such a file.
1619
1620       VERSION specifies the version of the library the .pri  file  describes.
1621       If  not  set, the value is taken from the context variable PROJECT_VER‐
1622       SION.  This variable is usually set by  the  project(...  VERSION  ...)
1623       command  or,  if  CMake  policy CMP0048 is not NEW, by ECMSetupVersion.
1624       For backward-compatibility with older  ECM  versions  the  PROJECT_VER‐
1625       SION_STRING  variable  as set by ECMSetupVersion will be preferred over
1626       PROJECT_VERSION if set, unless the minimum required version of  ECM  is
1627       5.83 and newer. Since 5.83.
1628
1629       BASE_NAME  specifies  the name qmake project (.pro) files should use to
1630       refer to the library (eg: KArchive).  LIB_NAME is the name of  the  ac‐
1631       tual  library  to  link  to  (ie: the first argument to add_library()).
1632       DEPS is a space-separated list of the base  names  of  other  libraries
1633       (for Qt libraries, use the same names you use with the QT variable in a
1634       qmake project file, such as “core” for QtCore).  FILENAME_VAR specifies
1635       the name of a variable to store the path to the generated file in.
1636
1637       INCLUDE_INSTALL_DIRS  are  the paths (relative to CMAKE_INSTALL_PREFIX)
1638       that include files will be installed to. It defaults  to  ${INCLUDE_IN‐
1639       STALL_DIR}/<baseName>  if  the  INCLUDE_INSTALL_DIR variable is set. If
1640       that variable is not set, the CMAKE_INSTALL_INCLUDEDIR variable is used
1641       instead, and if neither are set include is used.  LIB_INSTALL_DIR oper‐
1642       ates similarly for the installation location for libraries; it defaults
1643       to ${LIB_INSTALL_DIR}, ${CMAKE_INSTALL_LIBDIR} or lib, in that order.
1644
1645       INCLUDE_INSTALL_DIR  is the old variant of INCLUDE_INSTALL_DIRS, taking
1646       only one directory.
1647
1648       Example usage:
1649
1650          ecm_generate_pri_file(
1651              BASE_NAME KArchive
1652              LIB_NAME KF5KArchive
1653              DEPS "core"
1654              FILENAME_VAR pri_filename
1655              VERSION 4.2.0
1656          )
1657          install(FILES ${pri_filename} DESTINATION ${ECM_MKSPECS_INSTALL_DIR})
1658
1659       A qmake-based project that wished to use this would then do:
1660
1661          QT += KArchive
1662
1663       in their .pro file.
1664
1665       Since pre-1.0.0.
1666
1667   ECMGenerateQmlTypes
1668       Generates plugins.qmltypes files for QML plugins.
1669
1670          ecm_generate_qmltypes(<org.kde.pluginname> 1.3
1671                                DESTINATION <${KDE_INSTALL_QMLDIR}/org/kde/pluginname>)
1672
1673       Makes it possible to generate plugins.qmltypes files for the QML  plug‐
1674       ins  that  our project offers. These files offer introspection upon our
1675       plugin and are useful for integrating with IDE language support of  our
1676       plugin.  It  offers information about the objects its methods and their
1677       argument types.
1678
1679       The developer will be in charge of making sure that these files are  up
1680       to  date.   The  plugin.qmltypes file will sit in the source directory.
1681       This function will include the code that installs the file in the right
1682       place  and  a  small  unit  test named qmltypes-pluginname-version that
1683       makes sure that it doesn’t need updating.
1684
1685       Since 5.33.0
1686
1687   ECMInstallIcons
1688       Installs icons, sorting them into the correct directories according  to
1689       the FreeDesktop.org icon naming specification.
1690
1691          ecm_install_icons(ICONS <icon> [<icon> [...]]
1692                            DESTINATION <icon_install_dir>
1693                            [LANG <l10n_code>]
1694                            [THEME <theme>])
1695
1696       The given icons, whose names must match the pattern:
1697
1698          <size>-<group>-<name>.<ext>
1699
1700       will  be  installed  to the appropriate subdirectory of DESTINATION ac‐
1701       cording to the FreeDesktop.org icon naming scheme. By default, they are
1702       installed  to  the  “hicolor”  theme, but this can be changed using the
1703       THEME argument.  If the icons are localized, the LANG argument  can  be
1704       used to install them in a locale-specific directory.
1705
1706       <size>  is  a  numeric pixel size (typically 16, 22, 32, 48, 64, 128 or
1707       256) or sc for scalable (SVG) files, <group> is  one  of  the  standard
1708       FreeDesktop.org icon groups (actions, animations, apps, categories, de‐
1709       vices, emblems, emotes, intl, mimetypes, places, status) and  <ext>  is
1710       one of .png, .mng or .svgz.
1711
1712       The typical installation directory is share/icons.
1713
1714          ecm_install_icons(ICONS 22-actions-menu_new.png
1715                            DESTINATION share/icons)
1716
1717       The  above  code  will  install  the  file  22-actions-menu_new.png  as
1718       ${CMAKE_INSTALL_PREFIX}/share/icons/<theme>/22x22/actions/menu_new.png
1719
1720       Users  of  the  KDEInstallDirs  module  would  normally  use  ${KDE_IN‐
1721       STALL_ICONDIR}  as  the  DESTINATION, while users of the GNUInstallDirs
1722       module should use ${CMAKE_INSTALL_DATAROOTDIR}/icons.
1723
1724       An old form of arguments will also be accepted:
1725
1726          ecm_install_icons(<icon_install_dir> [<l10n_code>])
1727
1728       This matches files named like:
1729
1730          <theme><size>-<group>-<name>.<ext>
1731
1732       where <theme> is one of
1733
1734hi for hicolor
1735
1736lo for locolor
1737
1738cr for the Crystal icon theme
1739
1740ox for the Oxygen icon theme
1741
1742br for the Breeze icon theme
1743
1744       With this syntax, the file hi22-actions-menu_new.png would be installed
1745       into <icon_install_dir>/hicolor/22x22/actions/menu_new.png
1746
1747       Since pre-1.0.0.
1748
1749   ECMMarkAsTest
1750       Marks a target as only being required for tests.
1751
1752          ecm_mark_as_test(<target1> [<target2> [...]])
1753
1754       This  will  cause  the  specified targets to not be built unless either
1755       BUILD_TESTING is set to ON or the user invokes the buildtests target.
1756
1757       BUILD_TESTING is created as a cache variable by the CTest module and by
1758       the KDECMakeSettings module.
1759
1760       Since pre-1.0.0.
1761
1762   ECMMarkNonGuiExecutable
1763       Marks an executable target as not being a GUI application.
1764
1765          ecm_mark_nongui_executable(<target1> [<target2> [...]])
1766
1767       This  will  indicate  to CMake that the specified targets should not be
1768       included in a MACOSX_BUNDLE and should not  be  WIN32_EXECUTABLEs.   On
1769       platforms other than MacOS X or Windows, this will have no effect.
1770
1771       Since pre-1.0.0.
1772
1773   ECMOptionalAddSubdirectory
1774       Make subdirectories optional.
1775
1776          ecm_optional_add_subdirectory(<dir>)
1777
1778       This  behaves like add_subdirectory(), except that it does not complain
1779       if the directory does not exist.  Additionally, if the  directory  does
1780       exist,  it  creates  an option to allow the user to skip it. The option
1781       will be named BUILD_<dir>.
1782
1783       This is useful for “meta-projects” that combine several mostly-indepen‐
1784       dent sub-projects.
1785
1786       If  the  CMake  variable  DISABLE_ALL_OPTIONAL_SUBDIRECTORIES is set to
1787       TRUE for the first CMake run on the project, all  optional  subdirecto‐
1788       ries  will be disabled by default (but can of course be enabled via the
1789       respective options).  For example, the following will disable  all  op‐
1790       tional subdirectories except the one named “foo”:
1791
1792          cmake -DDISABLE_ALL_OPTIONAL_SUBDIRECTORIES=TRUE -DBUILD_foo=TRUE myproject
1793
1794       Since pre-1.0.0.
1795
1796   ECMPackageConfigHelpers
1797       Helper macros for generating CMake package config files.
1798
1799       write_basic_package_version_file()  is  the same as the one provided by
1800       the CMakePackageConfigHelpers module in CMake; see that module’s  docu‐
1801       mentation for more information.
1802
1803          ecm_configure_package_config_file(<input> <output>
1804              INSTALL_DESTINATION <path>
1805              [PATH_VARS <var1> [<var2> [...]]
1806              [NO_SET_AND_CHECK_MACRO]
1807              [NO_CHECK_REQUIRED_COMPONENTS_MACRO])
1808
1809       This  behaves  in  the same way as configure_package_config_file() from
1810       CMake 2.8.12, except that it adds an extra  helper  macro:  find_depen‐
1811       dency().  It  is highly recommended that you read the documentation for
1812       CMakePackageConfigHelpers for more information, particularly  with  re‐
1813       gard to the PATH_VARS argument.
1814
1815       Note  that there is no argument that will disable the find_dependency()
1816       macro; if you do not require this macro, you should use configure_pack‐
1817       age_config_file from the CMakePackageConfigHelpers module.
1818
1819       CMake  3.0 includes a CMakeFindDependencyMacro module that provides the
1820       find_dependency() macro (which you can include() in your package config
1821       file), so this file is only useful for projects wishing to provide con‐
1822       fig files that will work with CMake 2.8.12.
1823
1824   Additional Config File Macros
1825          find_dependency(<dep> [<version> [EXACT]])
1826
1827       find_dependency() should be used  instead  of  find_package()  to  find
1828       package  dependencies.   It  forwards the correct parameters for EXACT,
1829       QUIET and REQUIRED which were passed  to  the  original  find_package()
1830       call.  It also sets an informative diagnostic message if the dependency
1831       could not be found.
1832
1833       Since pre-1.0.0.
1834
1835   ECMPoQmTools
1836       This  module  provides  the  ecm_process_po_files_as_qm   and   ecm_in‐
1837       stall_po_files_as_qm  functions  for generating QTranslator (.qm) cata‐
1838       logs from Gettext (.po) catalogs, and the ecm_create_qm_loader function
1839       for  generating  the necessary code to load them in a Qt application or
1840       library.
1841
1842          ecm_process_po_files_as_qm(<lang> [ALL]
1843                                     [INSTALL_DESTINATION <install_destination>]
1844                                     PO_FILES <pofile> [<pofile> [...]])
1845
1846       Compile .po files into .qm files for the given language.
1847
1848       If INSTALL_DESTINATION is given, the .qm files are  installed  in  <in‐
1849       stall_destination>/<lang>/LC_MESSAGES. Typically, <install_destination>
1850       is set to share/locale.
1851
1852       ecm_process_po_files_as_qm creates a “translations” target. This target
1853       builds  all .po files into .qm files.  If ALL is specified, these rules
1854       are added to the “all” target (and so the .qm files will  be  built  by
1855       default).
1856
1857          ecm_create_qm_loader(<sources_var_name(|target (since 5.83))> <catalog_name>)
1858
1859       Generates  C++ code which ensures translations are automatically loaded
1860       at startup. The generated files are  appended  to  the  variable  named
1861       <sources_var_name>  or, if the first argument is a target (since 5.83),
1862       to the SOURCES property of <target>. Any target must  be  created  with
1863       add_executable() or add_library() and not be an alias.
1864
1865       It  assumes that the .qm file for the language code <lang> is installed
1866       as    <sharedir>/locale/<lang>/LC_MESSAGES/<catalog_name>.qm,     where
1867       <sharedir>  is  one of the directories given by the GenericDataLocation
1868       of QStandardPaths.
1869
1870       Typical usage is like:
1871
1872          set(mylib_SRCS foo.cpp bar.cpp)
1873          ecm_create_qm_loader(mylib_SRCS mycatalog)
1874          add_library(mylib ${mylib_SRCS})
1875
1876          # Or, since 5.83:
1877          add_library(mylib foo.cpp bar.cpp)
1878          ecm_create_qm_loader(mylib mycatalog)
1879
1880          ecm_install_po_files_as_qm(<podir>)
1881
1882       Searches for .po files and installs them to the standard location.
1883
1884       This is a convenience function which relies on all .po files being kept
1885       in  <podir>/<lang>/,  where  <lang>  is  the language the .po files are
1886       written in.
1887
1888       For example, given the following directory structure:
1889
1890          po/
1891            fr/
1892              mylib.po
1893
1894       ecm_install_po_files_as_qm(po) compiles mylib.po into mylib.qm and  in‐
1895       stalls  it  in <install_destination>/fr/LC_MESSAGES.  <install_destina‐
1896       tion> defaults to ${LOCALE_INSTALL_DIR} if defined, otherwise  it  uses
1897       ${CMAKE_INSTALL_LOCALEDIR}  if  that  is  defined,  otherwise  it  uses
1898       share/locale.
1899
1900       Since pre-1.0.0.
1901
1902   ECMQmlModule
1903       This file contains helper functions to make it  easier  to  create  QML
1904       modules.  It takes care of a number of things that often need to be re‐
1905       peated. It also takes care of special handling of QML  modules  between
1906       shared  and static builds. When building a static version of a QML mod‐
1907       ule, the relevant QML source files are bundled into the static library.
1908       When  using  a  shared build, the QML plugin and relevant QML files are
1909       copied to the target’s RUNTIME_OUTPUT_DIRECTORY to make  it  easier  to
1910       run things directly from the build directory.
1911
1912       Example usage:
1913
1914          ecm_add_qml_module(ExampleModule URI "org.example.Example" VERSION 1.4)
1915
1916          target_sources(ExampleModule PRIVATE ExamplePlugin.cpp)
1917          target_link_libraries(ExampleModule PRIVATE Qt::Quick)
1918
1919          ecm_target_qml_sources(ExampleModule SOURCES ExampleItem.qml)
1920          ecm_target_qml_sources(ExampleModule SOURCES AnotherExampleItem.qml VERSION 1.5)
1921
1922          ecm_finalize_qml_module(ExampleModule DESTINATION ${KDE_INSTALL_QMLDIR})
1923
1924          ecm_add_qml_module(<target name> URI <module uri> [VERSION <module version>] [NO_PLUGIN] [CLASSNAME <class name>])
1925
1926       This  will declare a new CMake target called <target name>. The URI ar‐
1927       gument is required and should be a proper QML module URI.  The  URI  is
1928       used, among others, to generate a subdirectory where the module will be
1929       installed to.
1930
1931       If the VERSION argument is specified, it is used to initialize the  de‐
1932       fault  version  that is used by  ecm_target_qml_sources when adding QML
1933       files. If it is not specified, a  default of 1.0 is used. Additionally,
1934       if  a version greater than or equal to 2.0 is specified, the major ver‐
1935       sion is appended to the installation path of the module.
1936
1937       If the option NO_PLUGIN is set, a target is declared that  is  not  ex‐
1938       pected to contain any C++ QML plugin.
1939
1940       If  the  optional  CLASSNAME  argument  is supplied, it will be used as
1941       class name in the generated QMLDIR file. If it is  not  specified,  the
1942       target name will be used instead.
1943
1944       You can add C++ and QML source files to the target using target_sources
1945       and ecm_target_qml_sources, respectively.
1946
1947       Since 5.91.0
1948
1949          ecm_add_qml_module_dependencies(<target> DEPENDS <module string> [<module string> ...])
1950
1951       Add the list of dependencies specified by the DEPENDS  argument  to  be
1952       listed as dependencies in the generated QMLDIR file of <target>.
1953
1954       Since 5.91.0
1955
1956          ecm_target_qml_sources(<target> SOURCES <source.qml> [<source.qml> ...] [VERSION <version>] [PATH <path>] [PRIVATE])
1957
1958       Add  the  list of QML files specified by the SOURCES argument as source
1959       files to the QML module target <target>.
1960
1961       If the optional VERSION argument is specified, all QML  files  will  be
1962       added with the specified version. If it is not specified, they will use
1963       the version of the QML module target.
1964
1965       If the optional PRIVATE argument is specified, the QML  files  will  be
1966       included  in  the target but not in the generated qmldir file. Any ver‐
1967       sion argument will be ignored.
1968
1969       The optional PATH argument declares a subdirectory of the module  where
1970       the  files should be copied to. By default, files will be copied to the
1971       module root.
1972
1973       This function will fail if <target> is not a QML module target  or  any
1974       of the specified files do not exist.
1975
1976       Since 5.91.0
1977
1978          ecm_finalize_qml_module(<target> DESTINATION <QML install destination>)
1979
1980       Finalize the specified QML module target. This must be called after all
1981       other setup (like adding sources) on the target has been done. It  will
1982       perform a number of tasks:
1983
1984       • It  will  generate a qmldir file from the QML files added to the tar‐
1985         get. If the module has a C++ plugin, this will also  be  included  in
1986         the qmldir file.
1987
1988       • If  BUILD_SHARED_LIBS  is  off,  a QRC file is generated from the QML
1989         files added to the target. This QRC file will be included  when  com‐
1990         piling the C++ QML module. The built static library will be installed
1991         in a subdirection of DESTINATION based on the QML module’s uri.  Note
1992         that  if  NO_PLUGIN is set, a C++ QML plugin will be generated to in‐
1993         clude the QRC files.
1994
1995       • If BUILD_SHARED_LIBS in on, all generated files, QML sources and  the
1996         C++  plugin  will be installed in a subdirectory of DESTINATION based
1997         upon the QML module’s uri. In addition,  these  files  will  also  be
1998         copied  to  the target’s RUNTIME_OUTPUT_DIRECTORY in a similar subdi‐
1999         rectory.
2000
2001       This function will fail if <target> is not a QML module target.
2002
2003       Since 5.91.0
2004
2005   ECMQtDeclareLoggingCategory
2006       This module provides the ecm_qt_declare_logging_category  function  for
2007       generating   declarations  for  logging  categories  in  Qt5,  and  the
2008       ecm_qt_install_logging_categories  function  for  generating  and   in‐
2009       stalling  a file in KDebugSettings format with the info about all those
2010       categories, as well as a file with info about any renamed categories if
2011       defined.  To include in that file any logging categories that are manu‐
2012       ally defined also a  function  ecm_qt_export_logging_category  is  pro‐
2013       vided.
2014
2015          ecm_qt_declare_logging_category(<sources_var_name(|target (since 5.80))>
2016              HEADER <filename>
2017              IDENTIFIER <identifier>
2018              CATEGORY_NAME <category_name>
2019              [OLD_CATEGORY_NAMES <oldest_cat_name> [<second_oldest_cat_name> [...]]]
2020              [DEFAULT_SEVERITY <Debug|Info|Warning|Critical|Fatal>]
2021              [EXPORT <exportid>]
2022              [DESCRIPTION <description>]
2023          )
2024
2025       A header file, <filename>, will be generated along with a corresponding
2026       source file. These will provide a QLoggingCategory category that can be
2027       referred to from C++ code using <identifier>, and from the logging con‐
2028       figuration using <category_name>.
2029
2030       The generated source file will be added to the variable with  the  name
2031       <sources_var_name>.  If  the given argument is a target though, instead
2032       both the generated header file and the generated source  file  will  be
2033       added  to  the  target as private sources (since 5.80). The target must
2034       not be an alias.
2035
2036       If <filename> is not absolute, it will be taken relative to the current
2037       binary directory.
2038
2039       <identifier> may include namespaces (eg: foo::bar::IDENT).
2040
2041       If  EXPORT  is passed, the category will be registered for the group id
2042       <exportid>. Info about the categories of that group can then be  gener‐
2043       ated  in  a  file  and  installed  by that group id with the ecm_qt_in‐
2044       stall_logging_categories function. In that case also  DESCRIPTION  will
2045       need  to  be passed, with <description> being a short single line text.
2046       And OLD_CATEGORY_NAMES can be used to inform about any renamings of the
2047       category, so user settings can be migrated. Since 5.68.0.
2048
2049       Since 5.14.0.
2050
2051          ecm_qt_export_logging_category(
2052              IDENTIFIER <identifier>
2053              CATEGORY_NAME <category_name>
2054              [OLD_CATEGORY_NAMES <oldest_category_name> [<second_oldest_category_name> [...]]]
2055              EXPORT <exportid>
2056              DESCRIPTION <description>
2057              [DEFAULT_SEVERITY <Debug|Info|Warning|Critical|Fatal>]
2058          )
2059
2060       Registers  a  logging  category for being included in the generated and
2061       installed KDebugSettings files. To be used for categories who  are  de‐
2062       clared  by  manual  code  or  other ways instead of code generated with
2063       ecm_qt_declare_logging_category.
2064
2065       <identifier> may include namespaces (eg: foo::bar::IDENT).
2066
2067       EXPORT specifies the group id with which the category  will  be  regis‐
2068       tered.   Info  about the categories of that group can then be generated
2069       in a file and installed by that group id with  the  ecm_qt_install_log‐
2070       ging_categories function.
2071
2072       DESCRIPTION specifies a short single line text describing the category.
2073
2074       OLD_CATEGORY_NAMES  can  be  used  to inform about any renamings of the
2075       category, so user settings can be migrated.
2076
2077       Since 5.68.0.
2078
2079          ecm_qt_install_logging_categories(
2080              EXPORT <exportid>
2081              [FILE <filename>]
2082              DESTINATION <install_path>
2083              [SORT]
2084              [COMPONENT <component>]
2085          )
2086
2087       Generates and installs a file in KDebugSettings format  with  the  info
2088       about  all  the categories registered for the group <exportid>, as well
2089       as a file with info about any renamed categories, if there are.
2090
2091       The method call needs to be after the last ecm_qt_declare_logging_cate‐
2092       gory  call  which uses the same <exportid>. This can be in the same di‐
2093       rectory, or any subdirectory or parent directory.
2094
2095       EXPORT specifies the group id of categories whose information should be
2096       stored in the file generated and installed.
2097
2098       FILE  specifies  the  name of the file generated and installed. It will
2099       default to lower-cased <exportid>.categories.
2100
2101       DESTINATION specifies where the generated file will be installed.
2102
2103       IF SORT is set, entries will be sorted by identifiers.
2104
2105       COMPONENT specifies the installation component name with which the  in‐
2106       stall rules for the generated file are associated.
2107
2108       Since  5.85.0  this is a no-op when building for Android, as KDebugSet‐
2109       tings is not available on that platform and the logging category  files
2110       therefore just bloat the APK.
2111
2112       Example usage:
2113
2114          ecm_qt_declare_logging_category(
2115              MYPROJECT_SRCS
2116              HEADER "myproject_debug.h"
2117              IDENTIFIER "MYPROJECT_DEBUG"
2118              CATEGORY_NAME "myproject"
2119              OLD_CATEGORY_NAMES "myprojectlog"
2120              DESCRIPTION "My project"
2121              EXPORT MyProject
2122          )
2123
2124          ecm_qt_export_logging_category(
2125              IDENTIFIER "MYPROJECT_SUBMODULE_DEBUG"
2126              CATEGORY_NAME "myproject.submodule"
2127              DESCRIPTION "My project - submodule"
2128              EXPORT MyProject
2129          )
2130
2131          ecm_qt_install_logging_categories(
2132              EXPORT MyProject
2133              FILE myproject.categories
2134              DESTINATION "${KDE_INSTALL_LOGGINGCATEGORIESDIR}"
2135          )
2136
2137       Since 5.68.0.
2138
2139   ECMQueryQt
2140       This module can be used to query the installation paths used by Qt.
2141
2142       For  Qt5 this uses qmake, and for Qt6 this used qtpaths (the latter has
2143       built-in  support  to  query  the  paths  of  a  target  platform  when
2144       cross-compiling).
2145
2146       This module defines the following function:
2147
2148          ecm_query_qt(<result_variable> <qt_variable> [TRY])
2149
2150       Passing  TRY will result in the method not making the build fail if the
2151       executable used for querying has not been  found,  but  instead  simply
2152       print a warning message and return an empty string.
2153
2154       Example usage:
2155
2156          include(ECMQueryQt)
2157          ecm_query_qt(bin_dir QT_INSTALL_BINS)
2158
2159       If the call succeeds ${bin_dir} will be set to <prefix>/path/to/bin/dir
2160       (e.g.  /usr/lib64/qt/bin/).
2161
2162       Since: 5.93
2163
2164   ECMSetupQtPluginMacroNames
2165       Instruct CMake’s automoc about C++ preprocessor macros used  to  define
2166       Qt-style plugins.
2167
2168          ecm_setup_qtplugin_macro_names(
2169              [JSON_NONE <macro_name> [<macro_name> [...]]]
2170              [JSON_ARG1 <macro_name> [<macro_name> [...]]]
2171              [JSON_ARG2 <macro_name> [<macro_name> [...]]]
2172              [JSON_ARG3 <macro_name> [<macro_name> [...]]]
2173              [CONFIG_CODE_VARIABLE <variable_name>] )
2174
2175       CMake’s automoc needs some support when parsing C++ source files to de‐
2176       tect whether moc should be run on those files and if there are also de‐
2177       pendencies  on  other files, like those with Qt plugin metadata in JSON
2178       format. Because automoc just greps overs the  raw  plain  text  of  the
2179       sources  without  any C++ preprocessor-like processing.  CMake in newer
2180       versions provides the variables CMAKE_AUTOMOC_DEPEND_FILTERS (CMake  >=
2181       3.9.0)  and  CMAKE_AUTOMOC_MACRO_NAMES (CMake >= 3.10) to allow the de‐
2182       veloper to assist automoc.
2183
2184       This macro cares for the explicit setup needed for those variables  for
2185       common cases of C++ preprocessor macros used for Qt-style plugins.
2186
2187       JSON_NONE lists the names of C++ preprocessor macros for Qt-style plug‐
2188       ins which do not refer to external files with the plugin metadata.
2189
2190       JSON_ARG1 lists the names of C++ preprocessor macros for Qt-style plug‐
2191       ins  where  the first argument to the macro is the name of the external
2192       file with the plugin metadata.
2193
2194       JSON_ARG2 is the same as JSON_ARG1 but with the  file  name  being  the
2195       second argument.
2196
2197       JSON_ARG3  is  the  same  as JSON_ARG1 but with the file name being the
2198       third argument.
2199
2200       CONFIG_CODE_VARIABLE specifies the name of the variable which will  get
2201       set  as value some generated CMake code for instructing automoc for the
2202       given macro names, as useful in an installed  CMake  config  file.  The
2203       variable  can  then  be  used  as usual in the template file for such a
2204       CMake config file, by @<variable_name>@.
2205
2206       Example usage:
2207
2208       Given some plugin-oriented Qt-based software which defines a custom C++
2209       preprocessor macro EXPORT_MYPLUGIN for declaring the central plugin ob‐
2210       ject:
2211
2212          #define EXPORT_MYPLUGIN_WITH_JSON(classname, jsonFile) \
2213          class classname : public QObject \
2214          { \
2215              Q_OBJECT \
2216              Q_PLUGIN_METADATA(IID "myplugin" FILE jsonFile) \
2217              explicit classname() {} \
2218          };
2219
2220       In the CMake buildsystem of the library one calls
2221
2222          ecm_setup_qtplugin_macro_names(
2223              JSON_ARG2
2224                 EXPORT_MYPLUGIN_WITH_JSON
2225          )
2226
2227       to instruct automoc about the usage of that macro in the sources of the
2228       library itself.
2229
2230       Given  the  software  installs  a library including the header with the
2231       macro definition and a CMake config file, so 3rd-party can create addi‐
2232       tional  plugins by linking against the library, one passes additionally
2233       the name of a variable which shall be  set  as  value  the  CMake  code
2234       needed to instruct automoc about the usage of that macro.
2235
2236          ecm_setup_qtplugin_macro_names(
2237              JSON_ARG2
2238                 EXPORT_MYPLUGIN_WITH_JSON
2239              CONFIG_CODE_VARIABLE
2240                 PACKAGE_SETUP_AUTOMOC_VARIABLES
2241          )
2242
2243       This  variable  then  is used in the template file (e.g.  MyProjectCon‐
2244       fig.cmake.in) for the libary’s installed CMake config file and that way
2245       will  ensure  that in the 3rd-party plugin’s buildsystem automoc is in‐
2246       structed as well as needed:
2247
2248          @PACKAGE_SETUP_AUTOMOC_VARIABLES@
2249
2250       Since 5.45.0.
2251
2252   ECMSetupVersion
2253       Handle library version information.
2254
2255          ecm_setup_version(<version>
2256                            VARIABLE_PREFIX <prefix>
2257                            [SOVERSION <soversion>]
2258                            [VERSION_HEADER <filename>]
2259                            [PACKAGE_VERSION_FILE <filename> [COMPATIBILITY <compat>]] )
2260
2261       This parses a version string and sets up  a  standard  set  of  version
2262       variables.  It can optionally also create a C version header file and a
2263       CMake package version file to install along with the library.
2264
2265       If the <version> argument is of the  form  <major>.<minor>.<patch>  (or
2266       <major>.<minor>.<patch>.<tweak>),  The  following  CMake  variables are
2267       set:
2268
2269          <prefix>_VERSION_MAJOR  - <major>
2270          <prefix>_VERSION_MINOR  - <minor>
2271          <prefix>_VERSION_PATCH  - <patch>
2272          <prefix>_VERSION        - <version>
2273          <prefix>_SOVERSION      - <soversion>, or <major> if SOVERSION was not given
2274
2275       For backward-compatibility also this variable is set (only if the mini‐
2276       mum required version of ECM is < 5.83):
2277
2278          <prefix>_VERSION_STRING - <version> (use <prefix>_VERSION instead)
2279
2280       If  CMake policy CMP0048 is not NEW, the following CMake variables will
2281       also be set:
2282
2283          PROJECT_VERSION_MAJOR   - <major>
2284          PROJECT_VERSION_MINOR   - <minor>
2285          PROJECT_VERSION_PATCH   - <patch>
2286          PROJECT_VERSION         - <version>
2287
2288       For backward-compatibility, if CMake policy CMP0048 is  not  NEW,  also
2289       this  variable is set (only if the minimum required version of ECM is <
2290       5.83):
2291
2292          PROJECT_VERSION_STRING  - <version> (use PROJECT_VERSION instead)
2293
2294       If the VERSION_HEADER option is used, a simple C  header  is  generated
2295       with  the  given filename. If filename is a relative path, it is inter‐
2296       preted as relative to CMAKE_CURRENT_BINARY_DIR.  The  generated  header
2297       contains the following macros:
2298
2299          <prefix>_VERSION_MAJOR  - <major> as an integer
2300          <prefix>_VERSION_MINOR  - <minor> as an integer
2301          <prefix>_VERSION_PATCH  - <patch> as an integer
2302          <prefix>_VERSION_STRING - <version> as a C string
2303          <prefix>_VERSION        - the version as an integer
2304
2305       <prefix>_VERSION  has <patch> in the bottom 8 bits, <minor> in the next
2306       8 bits and <major> in the remaining bits.  Note that <patch>  and  <mi‐
2307       nor> must be less than 256.
2308
2309       If the PACKAGE_VERSION_FILE option is used, a simple CMake package ver‐
2310       sion file is created using the write_basic_package_version_file() macro
2311       provided  by  CMake. It should be installed in the same location as the
2312       Config.cmake file of the library so that it can be found by  find_pack‐
2313       age().   If the filename is a relative path, it is interpreted as rela‐
2314       tive to CMAKE_CURRENT_BINARY_DIR. The optional COMPATIBILITY option  is
2315       forwarded   to   write_basic_package_version_file(),  and  defaults  to
2316       AnyNewerVersion.
2317
2318       If CMake policy CMP0048 is NEW, an alternative form of the  command  is
2319       available:
2320
2321          ecm_setup_version(PROJECT
2322                            [VARIABLE_PREFIX <prefix>]
2323                            [SOVERSION <soversion>]
2324                            [VERSION_HEADER <filename>]
2325                            [PACKAGE_VERSION_FILE <filename>] )
2326
2327       This  will  use  the  version information set by the project() command.
2328       VARIABLE_PREFIX defaults to the project name.  Note that  PROJECT  must
2329       be  the  first  argument.   In  all other respects, it behaves like the
2330       other form of the command.
2331
2332       Since pre-1.0.0.
2333
2334       COMPATIBILITY option available since 1.6.0.
2335
2336   ECMSourceVersionControl
2337       Tries to determine whether the source is  under  version  control  (git
2338       clone, svn checkout, etc).
2339
2340       ECM_SOURCE_UNDER_VERSION_CONTROL  is  set when indication is found that
2341       CMAKE_SOURCE_DIR is under version control.
2342
2343       Since 5.63
2344
2345   ECMUninstallTarget
2346       Add an uninstall target.
2347
2348       By including this module, an uninstall target will  be  added  to  your
2349       CMake  project.  This will remove all files installed (or updated) by a
2350       previous invocation of the install target. It  will  not  remove  files
2351       created or modified by an install(SCRIPT) or install(CODE) command; you
2352       should create a custom uninstallation target for these and use  add_de‐
2353       pendency to make the uninstall target depend on it:
2354
2355          include(ECMUninstallTarget)
2356          install(SCRIPT install-foo.cmake)
2357          add_custom_target(uninstall_foo COMMAND ${CMAKE_COMMAND} -P uninstall-foo.cmake)
2358          add_dependency(uninstall uninstall_foo)
2359
2360       The  target will fail if the install target has not yet been run (so it
2361       is not possible to run CMake on the project and  then  immediately  run
2362       the uninstall target).
2363
2364       WARNING:
2365          CMake  deliberately  does not provide an uninstall target by default
2366          on the basis that such a target has the potential to  remove  impor‐
2367          tant files from a user’s computer. Use with caution.
2368
2369       Since 1.7.0.
2370
2371   ECMUseFindModules
2372       Selectively  use  some of the find modules provided by extra-cmake-mod‐
2373       ules.
2374
2375       This module is automatically  available  once  extra-cmake-modules  has
2376       been  found,  so  it is not necessary to include(ECMUseFindModules) ex‐
2377       plicitly.
2378
2379          ecm_use_find_modules(DIR <dir>
2380                               MODULES module1.cmake [module2.cmake [...]]
2381                               [NO_OVERRIDE])
2382
2383       This allows selective use of the find modules provided by ECM,  includ‐
2384       ing  deferring  to  CMake’s  versions  of those modules if it has them.
2385       Rather than adding ${ECM_FIND_MODULE_DIR} to CMAKE_MODULE_PATH, you use
2386       ecm_use_find_modules()  to copy the modules you want to a local (build)
2387       directory, and add that to CMAKE_MODULE_PATH.
2388
2389       The find modules given to MODULES will be copied to the directory given
2390       by  DIR  (which  should  be located in ${CMAKE_BINARY_DIR} and added to
2391       CMAKE_MODULE_PATH).  If NO_OVERRIDE is given,  only  modules  not  also
2392       provided by CMake will be copied.
2393
2394       Example:
2395
2396          find_package(ECM REQUIRED)
2397          ecm_use_find_modules(
2398              DIR ${CMAKE_BINARY_DIR}/cmake
2399              MODULES FindEGL.cmake
2400              NO_OVERRIDE
2401          )
2402          set(CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR}/cmake)
2403
2404       This  example  will  make  FindEGL.cmake available in your project, but
2405       only as long as it is not yet part of CMake. Calls to find_package(EGL)
2406       will then make use of this copied module (or the CMake module if it ex‐
2407       ists).
2408
2409       Another possible use for this macro is to take copies of  find  modules
2410       that can be installed along with config files if they are required as a
2411       dependency (for example, if targets provided by the find module are  in
2412       the link interface of a library).
2413
2414       Since pre-1.0.0.
2415
2416   ECMWinResolveSymlinks
2417       Resolve pseudo-symlinks created by git when cloning on Windows.
2418
2419          ecm_win_resolve_symlinks(<dir>)
2420
2421       When git checks out a repository with UNIX symlinks on Windows machine,
2422       it creates a text file for each symlink, containing a relative path  to
2423       the real file.  This function would recursively walk over specified di‐
2424       rectory and replace pseudo-symlinks with corresponding real file’s con‐
2425       tents. It would then run git update-index --assume-unchanged on them to
2426       trick git.
2427
2428       This is useful for projects like “breeze-icons” that contain many iden‐
2429       tical icons implemented as symlinks.
2430
2431       Since 5.28
2432
2433   QtVersionOption
2434       Adds  a  build option to select the major Qt version if necessary, that
2435       is, if the major Qt version has not yet been determined otherwise (e.g.
2436       by  a corresponding find_package() call).  This module is typically in‐
2437       cluded by other modules requiring knowledge about the major Qt version.
2438
2439       QT_MAJOR_VERSION is defined to either be “5” or “6”.
2440
2441       Since 5.82.0.
2442

SEE ALSO

2444       ecm(7), ecm-find-modules(7), ecm-kde-modules(7)
2445
2447       KDE Developers
2448
2449
2450
2451
24525.102                            Jan 14, 2023                   ECM-MODULES(7)
Impressum