diff options
author | Cristian Adam <cristian.adam@gmail.com> | 2019-09-19 21:56:31 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-09-23 15:13:13 (GMT) |
commit | acb9511044a230126289c1e99cfed134c3be3c52 (patch) | |
tree | 4beb957a681b2baa9095c4f18f0254fbb29555d9 /Help | |
parent | ebb9346490741ddc2ce6f552bc1be57dfc730cfa (diff) | |
download | CMake-acb9511044a230126289c1e99cfed134c3be3c52.zip CMake-acb9511044a230126289c1e99cfed134c3be3c52.tar.gz CMake-acb9511044a230126289c1e99cfed134c3be3c52.tar.bz2 |
Precompile headers: Treat headers as relative to current source directory
Teach `target_precompile_headers` to treat relative paths the
same way as `target_sources`.
Fixes: #19733
Diffstat (limited to 'Help')
-rw-r--r-- | Help/command/target_precompile_headers.rst | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/Help/command/target_precompile_headers.rst b/Help/command/target_precompile_headers.rst index 7d36b11..3a32f41 100644 --- a/Help/command/target_precompile_headers.rst +++ b/Help/command/target_precompile_headers.rst @@ -48,17 +48,32 @@ 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. +Usage +^^^^^ + .. code-block:: cmake target_precompile_headers(<target> PUBLIC - "project_header.h" + project_header.h PRIVATE + [["other_header.h"]] <unordered_map> ) -Header files will be double quoted if they are not specified with double -quotes or angle brackets. +The list of header files is used to generate a header file named +``cmake_pch.h|xx`` which is used to generate the precompiled header file +(``.pch``, ``.gch``, ``.pchi``) artifact. The ``cmake_pch.h|xx`` header +file will be force included (``-include`` for GCC, ``/FI`` for MSVC) to +all source files, so sources do not need to have ``#include "pch.h"``. + +Header file names specified with angle brackets (e.g. ``<unordered_map>``) or +explicit double quotes (escaped for the :manual:`cmake-language(7)`, +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. See Also ^^^^^^^^ |