I actually have a simple question, but couldn\'t find an answer. Maybe you can point me to a duplicate. So, the question is: is it possible to tell cmake to instruct a compi
as pointed out in the examples above, "force including" could be useful for pre-compiled headers.
this is actually what cmake's target_precompile_headers does. https://cmake.org/cmake/help/git-stage/command/target_precompile_headers.html
for this context-of-use:
force including the header is actually a nice feature, since it allows you to use precompiled headers with MSVC, clang and gcc without changing your source.
it is also a nice feature, because it allows you to switch on/off PCH with just a configuration change (e.g. in cmake). this allows you to test that your source builds also without the precompiled headers (e.g. for compilers/situations that don't support it). for instance clang-tidy gets confused about PCH (at least in combination with MSVC).