diff options
author | Cristian Adam <cristian.adam@gmail.com> | 2019-07-31 16:54:44 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-08-28 15:47:51 (GMT) |
commit | 8da78d4efe0e4d0ef8708ecd94cf886c3f7d9ae4 (patch) | |
tree | 999fd79cb6487f27583cf354667dff517998a0f6 /Help/command | |
parent | 577293016430115a2d7dec5e3588f12bcabc96ec (diff) | |
download | CMake-8da78d4efe0e4d0ef8708ecd94cf886c3f7d9ae4.zip CMake-8da78d4efe0e4d0ef8708ecd94cf886c3f7d9ae4.tar.gz CMake-8da78d4efe0e4d0ef8708ecd94cf886c3f7d9ae4.tar.bz2 |
Precompile headers: Update documentation
Diffstat (limited to 'Help/command')
-rw-r--r-- | Help/command/target_precompile_headers.rst | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/Help/command/target_precompile_headers.rst b/Help/command/target_precompile_headers.rst new file mode 100644 index 0000000..3e28265 --- /dev/null +++ b/Help/command/target_precompile_headers.rst @@ -0,0 +1,56 @@ +target_precompile_headers +------------------------- + +Add a list of header files to precompile. + +.. code-block:: cmake + + target_precompile_headers(<target> + <INTERFACE|PUBLIC|PRIVATE> [header1...] + [<INTERFACE|PUBLIC|PRIVATE> [header2...] ...]) + +Adds header files to :prop_tgt:`PRECOMPILE_HEADERS` or +:prop_tgt:`INTERFACE_PRECOMPILE_HEADERS` target properties. + +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. + +The named ``<target>`` must have been created by a command such as +:command:`add_executable` or :command:`add_library` and must not be an +:ref:`ALIAS target <Alias Targets>`. + +The ``INTERFACE``, ``PUBLIC`` and ``PRIVATE`` keywords are required to +specify the scope of the following arguments. ``PRIVATE`` and ``PUBLIC`` +items will populate the :prop_tgt:`PRECOMPILE_HEADERS` property of +``<target>``. ``PUBLIC`` and ``INTERFACE`` items will populate the +:prop_tgt:`INTERFACE_PRECOMPILE_HEADERS` property of ``<target>``. +(:ref:`IMPORTED targets <Imported Targets>` only support ``INTERFACE`` items.) +Repeated calls for the same ``<target>`` append items in the order called. + +Arguments to ``target_precompile_headers`` may use "generator expressions" +with the syntax ``$<...>``. +See the :manual:`cmake-generator-expressions(7)` manual for available +expressions. See the :manual:`cmake-compile-features(7)` manual for +information on compile features and a list of supported compilers. + +.. code-block:: cmake + + target_precompile_headers(<target> + PUBLIC + "project_header.h" + PRIVATE + <unordered_map> + ) + +Header files will be double quoted if they are not specified with double +quotes or angle brackets. + +See Also +^^^^^^^^ + +For disabling precompile headers for specific targets there is the +property :prop_tgt:`DISABLE_PRECOMPILE_HEADERS`. + +For skipping certain source files there is the source file property +:prop_sf:`SKIP_PRECOMPILE_HEADERS`. |