summaryrefslogtreecommitdiffstats
path: root/Help/prop_tgt
diff options
context:
space:
mode:
authorSebastian Holtermann <sebholt@xwmw.org>2017-08-18 11:58:14 (GMT)
committerSebastian Holtermann <sebholt@xwmw.org>2017-08-18 11:58:14 (GMT)
commit7529d84facc8c5b3ddfc916c20c5998d6aa9acaf (patch)
treec5189919b902e809a0dcbbc21878912c0db11777 /Help/prop_tgt
parent05891d8f774cc2ac3fea44f6f320dcdc2e1d95e2 (diff)
downloadCMake-7529d84facc8c5b3ddfc916c20c5998d6aa9acaf.zip
CMake-7529d84facc8c5b3ddfc916c20c5998d6aa9acaf.tar.gz
CMake-7529d84facc8c5b3ddfc916c20c5998d6aa9acaf.tar.bz2
Autogen: Add documentation for AUTOMOC_MACRO_NAMES
Diffstat (limited to 'Help/prop_tgt')
-rw-r--r--Help/prop_tgt/AUTOMOC.rst14
-rw-r--r--Help/prop_tgt/AUTOMOC_MACRO_NAMES.rst28
2 files changed, 37 insertions, 5 deletions
diff --git a/Help/prop_tgt/AUTOMOC.rst b/Help/prop_tgt/AUTOMOC.rst
index e70fe0d..61813be68 100644
--- a/Help/prop_tgt/AUTOMOC.rst
+++ b/Help/prop_tgt/AUTOMOC.rst
@@ -5,8 +5,8 @@ Should the target be processed with automoc (for Qt projects).
AUTOMOC is a boolean specifying whether CMake will handle the Qt ``moc``
preprocessor automatically, i.e. without having to use the
-:module:`QT4_WRAP_CPP() <FindQt4>` or QT5_WRAP_CPP() macro. Currently Qt4 and Qt5 are
-supported.
+:module:`QT4_WRAP_CPP() <FindQt4>` or QT5_WRAP_CPP() macro.
+Currently Qt4 and Qt5 are supported.
When this property is set ``ON``, CMake will scan the header and
source files at build time and invoke moc accordingly.
@@ -37,7 +37,7 @@ source files at build time and invoke moc accordingly.
which is compiled as part of the target.
* The custom directories with checksum
- based names help to avoid name collisions for moc files with the same
+ based names help to avoid name collisions for ``moc`` files with the same
``<basename>``.
* See :prop_tgt:`AUTOGEN_BUILD_DIR`.
@@ -56,11 +56,11 @@ source files at build time and invoke moc accordingly.
This property is initialized by the value of the :variable:`CMAKE_AUTOMOC`
variable if it is set when a target is created.
-Additional command line options for moc can be set via the
+Additional command line options for ``moc`` can be set via the
:prop_tgt:`AUTOMOC_MOC_OPTIONS` property.
By enabling the :variable:`CMAKE_AUTOMOC_RELAXED_MODE` variable the
-rules for searching the files which will be processed by moc can be relaxed.
+rules for searching the files which will be processed by ``moc`` can be relaxed.
See the documentation for this variable for more details.
The global property :prop_gbl:`AUTOGEN_TARGETS_FOLDER` can be used to group the
@@ -69,6 +69,10 @@ automoc targets together in an IDE, e.g. in MSVS.
The global property :prop_gbl:`AUTOGEN_SOURCE_GROUP` can be used to group
files generated by :prop_tgt:`AUTOMOC` together in an IDE, e.g. in MSVS.
+The appearance of the strings ``Q_OBJECT`` or ``Q_GADGET`` in a source file
+determines if it needs to be ``moc`` processed. To search for additional
+strings, list them in :prop_tgt:`AUTOMOC_MACRO_NAMES`.
+
Additional ``moc`` dependency file names can be extracted from source code
by using :prop_tgt:`AUTOMOC_DEPEND_FILTERS`.
diff --git a/Help/prop_tgt/AUTOMOC_MACRO_NAMES.rst b/Help/prop_tgt/AUTOMOC_MACRO_NAMES.rst
new file mode 100644
index 0000000..0639bc8
--- /dev/null
+++ b/Help/prop_tgt/AUTOMOC_MACRO_NAMES.rst
@@ -0,0 +1,28 @@
+AUTOMOC_MACRO_NAMES
+-------------------
+
+Additional macro names used by :prop_tgt:`AUTOMOC`
+to determine if a C++ file needs to be processed by ``moc``.
+
+This property is only used if the :prop_tgt:`AUTOMOC` property is ``ON``
+for this target.
+
+CMake searches for the strings ``Q_OBJECT`` and ``Q_GADGET`` to
+determine if a file needs to be processed by ``moc``.
+:prop_tgt:`AUTOMOC_MACRO_NAMES` allows to add additional strings to the
+search list. This is useful for cases where the ``Q_OBJECT`` or ``Q_GADGET``
+macro is hidden inside another macro.
+
+By default :prop_tgt:`AUTOMOC_MACRO_NAMES` is initialized from
+:variable:`CMAKE_AUTOMOC_MACRO_NAMES`, which is empty by default.
+
+See the :manual:`cmake-qt(7)` manual for more information on using CMake
+with Qt.
+
+Example
+-------
+In this case the the ``Q_OBJECT`` macro is hidden inside an other macro
+called ``CUSTOM_MACRO``. To let CMake know that source files, that contain
+``CUSTOM_MACRO``, need to be ``moc`` processed, we call::
+
+ set_property(TARGET tgt PROPERTY AUTOMOC_MACRO_NAMES "CUSTOM_MACRO")