summaryrefslogtreecommitdiffstats
path: root/Help
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-04-28 11:08:53 (GMT)
committerKitware Robot <kwrobot@kitware.com>2020-04-28 11:09:00 (GMT)
commit41d37e45e9e2d5758c19a8b09c72f54d63f9827d (patch)
treeebad80c3af12f6e5cb9a11b90deae2695f9bd2fc /Help
parent354c681434a02a4dff9bb31d046f44c465bb08af (diff)
parentb204bae2613494a5ce779a4a7f9b000d84b8ab03 (diff)
downloadCMake-41d37e45e9e2d5758c19a8b09c72f54d63f9827d.zip
CMake-41d37e45e9e2d5758c19a8b09c72f54d63f9827d.tar.gz
CMake-41d37e45e9e2d5758c19a8b09c72f54d63f9827d.tar.bz2
Merge topic 'pch-genex-absolute' into release-3.17
b204bae261 target_precompile_headers: Fix documented example using genex Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: Cristian Adam <cristian.adam@gmail.com> Merge-request: !4678
Diffstat (limited to 'Help')
-rw-r--r--Help/command/target_precompile_headers.rst27
1 files changed, 13 insertions, 14 deletions
diff --git a/Help/command/target_precompile_headers.rst b/Help/command/target_precompile_headers.rst
index 569c7eb..0d4f45a 100644
--- a/Help/command/target_precompile_headers.rst
+++ b/Help/command/target_precompile_headers.rst
@@ -56,35 +56,34 @@ e.g. ``[["other_header.h"]]``) will be treated as is, and include directories
must be available for the compiler to find them. Other header file names
(e.g. ``project_header.h``) are interpreted as being relative to the current
source directory (e.g. :variable:`CMAKE_CURRENT_SOURCE_DIR`) and will be
-included by absolute path.
-
-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.
-The ``$<COMPILE_LANGUAGE:...>`` generator expression is particularly
-useful for specifying a language-specific header to precompile for
-only one language (e.g. ``CXX`` and not ``C``). For example:
+included by absolute path. For example:
.. code-block:: cmake
target_precompile_headers(myTarget
PUBLIC
project_header.h
- "$<$<COMPILE_LANGUAGE:CXX>:cxx_only.h>"
PRIVATE
[["other_header.h"]]
<unordered_map>
)
-When specifying angle brackets inside a :manual:`generator expression
-<cmake-generator-expressions(7)>`, be sure to encode the closing ``>``
-as ``$<ANGLE-R>``. For example:
+Arguments to ``target_precompile_headers()`` may use "generator expressions"
+with the syntax ``$<...>``.
+See the :manual:`cmake-generator-expressions(7)` manual for available
+expressions.
+The ``$<COMPILE_LANGUAGE:...>`` generator expression is particularly
+useful for specifying a language-specific header to precompile for
+only one language (e.g. ``CXX`` and not ``C``). In this case, header
+file names that are not explicitly in double quotes or angle brackets
+must be specified by absolute path. Also, when specifying angle brackets
+inside a generator expression, be sure to encode the closing ``>`` as
+``$<ANGLE-R>``. For example:
.. code-block:: cmake
target_precompile_headers(mylib PRIVATE
+ "$<$<COMPILE_LANGUAGE:CXX>:${CMAKE_CURRENT_SOURCE_DIR}/cxx_only.h>"
"$<$<COMPILE_LANGUAGE:C>:<stddef.h$<ANGLE-R>>"
"$<$<COMPILE_LANGUAGE:CXX>:<cstddef$<ANGLE-R>>"
)