[CMake] Precompiled Headers

Brad King brad.king at kitware.com
Mon Jun 8 09:56:33 EDT 2009


Pau Garcia i Quiles wrote:
> Apart from every compiler making this different (i. e. different
> parameters for each compilers), what are the difficulties you see for
> making this a first-class feature?

It's not the different flags for each compiler that makes it hard.
We already do that for other features like building shared libraries.

A couple years ago I dove pretty deep into the problem.  There are
several gotchas but I don't remember them all off the top of my head.
IIRC, some of the problems were:

   - Determining which sources can safely use a PCH
   - Sharing PCH files across targets (esp. in VS)
   - Avoiding need for cooperation with content in sources
   - Dependencies
   - Relationship of .pch and .obj build rules varies

It is tricky to come up with a simple interface that is implementable
on all platforms.  Nothing is a showstopper, but no one has taken the
time to take it all the way (VS, GCC, Xcode, Intel CC, HP, Sun, SGI).

-Brad


More information about the CMake mailing list