summaryrefslogtreecommitdiffstats
path: root/Help/command/target_precompile_headers.rst
diff options
context:
space:
mode:
authorCristian Adam <cristian.adam@gmail.com>2019-08-30 14:21:19 (GMT)
committerCristian Adam <cristian.adam@gmail.com>2019-09-17 09:58:38 (GMT)
commit729d997f1073c7a177da5b46b073a08b95adfa74 (patch)
tree0b419aebe0dcb8a30686861954c4e8515d448a1d /Help/command/target_precompile_headers.rst
parent1ac4e0ef1b29affc9e4f2cd86c4fc8c2252f2ab2 (diff)
downloadCMake-729d997f1073c7a177da5b46b073a08b95adfa74.zip
CMake-729d997f1073c7a177da5b46b073a08b95adfa74.tar.gz
CMake-729d997f1073c7a177da5b46b073a08b95adfa74.tar.bz2
Precompile Headers: Add REUSE_FROM signature
Add the ability to share precompiled headers artifacts between targets. Fixes: #19659
Diffstat (limited to 'Help/command/target_precompile_headers.rst')
-rw-r--r--Help/command/target_precompile_headers.rst14
1 files changed, 14 insertions, 0 deletions
diff --git a/Help/command/target_precompile_headers.rst b/Help/command/target_precompile_headers.rst
index 3e28265..7d36b11 100644
--- a/Help/command/target_precompile_headers.rst
+++ b/Help/command/target_precompile_headers.rst
@@ -9,9 +9,23 @@ Add a list of header files to precompile.
<INTERFACE|PUBLIC|PRIVATE> [header1...]
[<INTERFACE|PUBLIC|PRIVATE> [header2...] ...])
+ target_precompile_headers(<target> REUSE_FROM <other_target>)
+
Adds header files to :prop_tgt:`PRECOMPILE_HEADERS` or
:prop_tgt:`INTERFACE_PRECOMPILE_HEADERS` target properties.
+The second signature will reuse an already precompiled header file artefact
+from another target. This is done by setting the
+:prop_tgt:`PRECOMPILE_HEADERS_REUSE_FROM` to ``<other_target>`` value.
+The ``<other_target>`` will become a dependency of ``<target>``.
+
+.. note::
+
+ The second signature will require the same set of compiler options,
+ compiler flags, compiler definitions for both ``<target>``, and
+ ``<other_target>``. Compilers (e.g. GCC) will issue a warning if the
+ precompiled header file cannot be used (``-Winvalid-pch``).
+
Precompiling header files can speed up compilation by creating a partially
processed version of some header files, and then using that version during
compilations rather than repeatedly parsing the original headers.