Autogen: Add AUTOMOC_DEPEND_FILTERS documentation

This commit is contained in:
Sebastian Holtermann 2017-02-23 13:50:29 +01:00
parent 94e3f82cf1
commit 96f6f392e3
7 changed files with 75 additions and 0 deletions

View File

@ -115,6 +115,7 @@ Properties on Targets
/prop_tgt/ARCHIVE_OUTPUT_NAME_CONFIG
/prop_tgt/ARCHIVE_OUTPUT_NAME
/prop_tgt/AUTOGEN_TARGET_DEPENDS
/prop_tgt/AUTOMOC_DEPEND_FILTERS
/prop_tgt/AUTOMOC_MOC_OPTIONS
/prop_tgt/AUTOMOC
/prop_tgt/AUTOUIC

View File

@ -87,6 +87,9 @@ following targets by setting the :variable:`CMAKE_AUTOMOC` variable. The
options to pass to ``moc``. The :variable:`CMAKE_AUTOMOC_MOC_OPTIONS`
variable may be populated to pre-set the options for all following targets.
Additional ``moc`` dependency file names can be extracted from source code
by using :prop_tgt:`AUTOMOC_DEPEND_FILTERS`.
Source C++ files can be excluded from :prop_tgt:`AUTOMOC` processing by
enabling :prop_sf:`SKIP_AUTOMOC` or the broader :prop_sf:`SKIP_AUTOGEN`.

View File

@ -256,6 +256,7 @@ Variables that Control the Build
/variable/CMAKE_ANDROID_STL_TYPE
/variable/CMAKE_ARCHIVE_OUTPUT_DIRECTORY
/variable/CMAKE_ARCHIVE_OUTPUT_DIRECTORY_CONFIG
/variable/CMAKE_AUTOMOC_DEPEND_FILTERS
/variable/CMAKE_AUTOMOC_MOC_OPTIONS
/variable/CMAKE_AUTOMOC
/variable/CMAKE_AUTORCC

View File

@ -57,6 +57,9 @@ See the documentation for this variable for more details.
The global property :prop_gbl:`AUTOGEN_TARGETS_FOLDER` can be used to group the
automoc targets together in an IDE, e.g. in MSVS.
Additional ``moc`` dependency file names can be extracted from source code
by using :prop_tgt:`AUTOMOC_DEPEND_FILTERS`.
Source C++ files can be excluded from :prop_tgt:`AUTOMOC` processing by
enabling :prop_sf:`SKIP_AUTOMOC` or the broader :prop_sf:`SKIP_AUTOGEN`.

View File

@ -0,0 +1,45 @@
AUTOMOC_DEPEND_FILTERS
----------------------
Filter definitions used by :prop_tgt:`AUTOMOC` to extract file names from
source code as additional dependencies for the ``moc`` file.
This property is only used if the :prop_tgt:`AUTOMOC` property is ``ON``
for this target.
Filters are defined as ``KEYWORD;REGULAR_EXPRESSION`` pairs. First the file
content is searched for ``KEYWORD``. If it is found at least once, then file
names are extracted by successively searching for ``REGULAR_EXPRESSION`` and
taking the first match group.
Consider a filter extracts the file name ``DEP`` from the content of a file
``FOO``. If ``DEP`` changes, then the ``moc`` file for ``FOO`` gets rebuilt.
The file ``DEP`` is searched for first in the vicinity
of ``FOO`` and afterwards in the target's :prop_tgt:`INCLUDE_DIRECTORIES`.
By default :prop_tgt:`AUTOMOC_DEPEND_FILTERS` is initialized from
:variable:`CMAKE_AUTOMOC_DEPEND_FILTERS`, which is empty by default.
See the :manual:`cmake-qt(7)` manual for more information on using CMake
with Qt.
Example
-------
Consider a file ``FOO.hpp`` holds a custom macro ``OBJ_JSON_FILE`` and we
want the ``moc`` file to depend on the macro`s file name argument::
class My_Class : public QObject
{
Q_OBJECT
OBJ_JSON_FILE ( "DEP.json" )
...
};
Then we might use :variable:`CMAKE_AUTOMOC_DEPEND_FILTERS` to
define a filter like this::
set(CMAKE_AUTOMOC_DEPEND_FILTERS
"OBJ_JSON_FILE" "[\n][ \t]*OBJ_JSON_FILE[ \t]*\\([ \t]*\"([^\"]+)\""
)

View File

@ -0,0 +1,10 @@
AutoGen depends
---------------
* Variable :variable:`CMAKE_AUTOMOC_DEPEND_FILTERS` was introduced to
allow :variable:`CMAKE_AUTOMOC` to extract additional dependency file names
for ``moc`` from the contents of source files.
* The new target property :prop_tgt:`AUTOMOC_DEPEND_FILTERS` was introduced to
allow :prop_tgt:`AUTOMOC` to extract additional dependency file names
for ``moc`` from the contents of source files.

View File

@ -0,0 +1,12 @@
CMAKE_AUTOMOC_DEPEND_FILTERS
----------------------------
Filter definitions used by :variable:`CMAKE_AUTOMOC`
to extract file names from source code as additional dependencies
for the ``moc`` file.
This variable is used to initialize the :prop_tgt:`AUTOMOC_DEPEND_FILTERS`
property on all the targets. See that target property for additional
information.
By default it is empty.