# Question about force inclusion with precompiled header

**URL:** https://discourse.cmake.org/t/question-about-force-inclusion-with-precompiled-header/11255
**Category:** Usage
**Created:** [July 15, 2024, 6:38pm UTC](https://discourse.cmake.org/t/question-about-force-inclusion-with-precompiled-header/11255 "2024-07-15T18:38:16Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![AlexG](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/a/ecc23a/32.png) [@AlexG](https://discourse.cmake.org/u/AlexG)
#### Post date: [July 15, 2024, 6:38pm UTC](https://discourse.cmake.org/t/question-about-force-inclusion-with-precompiled-header/11255/1 "2024-07-15T18:38:16Z")

</div>

Hello everyone,

I am successfully using precompiled header in my project to speed up build times. I noticed while reading the documentation about `target_precompile_headers` the following:

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"` .

Is there a way to avoid the forced inclusion of the precompiled header? I am wondering if it is possible to avoid that in such a way that the source files that make use of the precompiled header explicitly have to `#include "pch.h"`.

Thank you very much for any help or clarification.

Alex

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [July 18, 2025, 8:14pm UTC](https://discourse.cmake.org/t/question-about-force-inclusion-with-precompiled-header/11255/2 "2025-07-18T20:14:14Z")

</div>

AFAIK, there is no way to do that. The main issue that comes to mind is that the wrong `pch.h` may be found if include paths are blindly trusted.
