[CMake] Secret precompiled header support?

Bill Hoffman bill.hoffman at kitware.com
Fri May 18 10:51:48 EDT 2012


On 5/17/2012 12:50 PM, Robert Dailey wrote:
> Normally when you encounter "professional" software (that is, software
> that you pay for, that is generally well designed and maintained by a
> single entity), it has a consistent feel. Open source naturally can feel
> inconsistent because of the large number of contributions, which
> sometimes don't follow the same implementation patterns. I hope that
> clarifies what I meant. An example, as I had stated, is general compiler
> flag support. For example, we have convenience methods for includes and
> preprocessor definitions, but PCH and warning levels does not have such
> a thing.
>
I don't think this is an open source vs closed source thing either.  I 
think it is more of a cross platform thing.  I have used plenty of 
software that you pay for that is missing features or very buggy expect 
there is no way to fix it yourself...  Not that I am saying CMake is 
buggy and missing features.. :)

What you are seeing in CMake is more a lack of cross platform support 
for PCH, and consistent warning levels in C++ compilers.  These things 
just are not consistent across various compilers and operating systems 
out there.  So, in those cases CMake has to step up and create a 
consistent API, which of course is much harder, and will have holes 
because various compiler won't support it. For example if we created 
some nice functions to do PCH, they would only work on a small 
percentage of the supported compilers.   Coming up with a mapping of 
warning flags is just as challenging.

However, include flags and preprocessor definitions are standard and 
"required" for a C++ compiler to work.  PCH and warning levels are not 
required to build C++, so those features are missing and vary in 
implementation across compilers.

The idea behind CMake is to provide as consistent a cross platform 
interface to the build as possible.  However, we allow access to 
platform specific flags and settings so that projects that need to work 
on a specific platform can do so.

Since, as you say "I am only a Windows developer", you should be able to 
put the windows specific PCH stuff into your project and it won't be too 
much of an issue for your project.

All that said, it would be nice to have a better interface for PCH 
support that would work when it was available.  However, to date it has 
not been a high priority.

So, not having these features has IMO little to do with CMake being 
professional or consistent, or Kitware taking CMake seriously, but 
rather with the difficulty of implementation and lack of standardization 
in C++ compilers.

-Bill


More information about the CMake mailing list