apeltauer wrote: ↑
Sun Nov 03, 2019 6:08 pm
@Werner, don’t you think we could also reduce the compile size when just using one big precompiled header file for all projects?
On travis it may reduce the build process by a a couple of minutes (for local builds it's probably much less). But the problem is that in the various PreCompiled.h files we have module-specific defines and handling them in a single PreCompiled.h is almost impossible. And if we even manage to get it working another major downside would be that as soon as you make a change you end up in re-compiling the whole project -- while for module-specific PCH's you would only rebuild that affected module.
Can someone give me a little help what the cmake functions are doing?
If you create a VS project and manually activate PCH it will activate some special compiler flags for the .cpp files. Therefore it must distinguish between the file the must be built as very first (the PreCompiled.cpp) and all other .cpp files. The ADD_MSVC_PRECOMPILED_HEADER macro just uses the MSVC-specific compiler switches.
GET_MSVC_PRECOMPILED_SOURCE can be used if in a CMake file you use a single variable to keep source and header files. Because the compiler switches can only be applied to source files you must extract the source files.