diff options
author | Gerion Entrup <gerion.entrup@flump.de> | 2019-10-18 17:55:53 +0200 |
---|---|---|
committer | Michael Hirsch, Ph.D <10931741+scivision@users.noreply.github.com> | 2019-10-18 13:13:52 -0400 |
commit | d5be103585ce992e73efd4fa4e47476a3292906f (patch) | |
tree | 3cdc2db4a3d7a57cf2d2db48866e2f959e08a95c | |
parent | af11f9207100aedad47058385618211358e0992f (diff) | |
download | meson-d5be103585ce992e73efd4fa4e47476a3292906f.zip meson-d5be103585ce992e73efd4fa4e47476a3292906f.tar.gz meson-d5be103585ce992e73efd4fa4e47476a3292906f.tar.bz2 |
Documentation: Extend example for precompiled headers
The documentation already contains an example for PCH but misses the
to show the content of the PCH files and how to create them.
With this commit exactly this is exlained.
-rw-r--r-- | docs/markdown/Precompiled-headers.md | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/docs/markdown/Precompiled-headers.md b/docs/markdown/Precompiled-headers.md index 8dfb438..d9ac7a4 100644 --- a/docs/markdown/Precompiled-headers.md +++ b/docs/markdown/Precompiled-headers.md @@ -51,16 +51,27 @@ Using precompiled headers with GCC and derivatives -- Once you have a file to precompile, you can enable the use of pch for -a give target with a *pch* keyword argument. As an example, here's how -you would use it with a C binary. +a give target with a *pch* keyword argument. As an example, let's assume +you want to build a small C binary with precompiled headers. +Let's say the source files of the binary use the system headers `stdio.h` +and `string.h`. Then you create a header file `pch/myexe_pch.h` with this +content: + +```c +#include <stdio.h> +#include <string.h> +``` + +And add this to meson: ```meson executable('myexe', sources : sourcelist, c_pch : 'pch/myexe_pch.h') ``` -You should note that your source files must _not_ include the file -`myexe_pch.h` and you must _not_ add the pch subdirectory to your -search path. Meson will make the compiler include the pch with +That's all. You should note that your source files must _not_ include +the file `myexe_pch.h` and you must _not_ add the pch subdirectory to +your search path. Any modification of the original program files is +not necessary. Meson will make the compiler include the pch with compiler options. If you want to disable pch (because of, say, compiler bugs), it can be done entirely on the build system side with no changes to source code. |