PCH (PreCompiled Headers) with CMake ?

Added by kervala about 5 years ago

http://en.wikipedia.org/wiki/Precompiled_header

Under Windows, we were already using PCH for a long time because without them, compilation is A LOT slower.

CMake doesn't propose PCH support by default, so we have to enable them ourself, so I googled and I found a module for enabling PCH.

Under GNU/Linux (tested on Ubuntu), I did a bench :

Without PCH activated :

  • i386 build of ryzom 0.7.0-r394~lucid0 in ubuntu lucid RELEASE -> 34 minutes
  • amd64 build of ryzom 0.6.0-r317~lucid1 in ubuntu lucid RELEASE -> 46 minutes

With PCH activated :

  • i386 build of nel 0.7.0-r404~lucid1 in ubuntu lucid RELEASE -> 23 minutes
  • amd64 build of nel 0.7.0-r404~lucid1 in ubuntu lucid RELEASE -> 29 minutes

It's not so important as under Windows, but it reduces compilation time more than 10 minutes.

Please test if PCH are working with your compiler (they are now enabled on default under all platform with CMake in the last revision).

Thanks