I have a large test suite that is compiled as an executable, that is roughly structured as follows:
ProjectRootDir
|
---A -> .cpp/h files with a fairly common set of expensive includes
|
---B -> .cpp/.h files with a fairly common but different set of expensive includes
|
(etc.)
Using precompiled headers greatly reduces the compile time of the entire project. But because this is a test project which means the pch included files can change often, ideally I'd have one pch for the 'A' source files, another pch for the 'B' source files, etc. In order to prevent recompiling the entire project every time a subset of the precompiled headers change. For changes where I truly do want to verify that the entire project still compiles.
What is the best way to do this in CMake?