[CMake] CMake and precompiled headers
Brad King
brad.king at kitware.com
Thu Feb 16 17:35:31 EST 2006
Gregor Berginc wrote:
> Hi all,
>
> I noticed a feature request for precompiled headers (bug# 1260). One
> mentioned there, that you can simply use SET_SOURCE_FILES_PROPERTIES
> for the time being. But, unfortunatelly, I can't seem to get it
> working. I put my header to the list of sources:
>
> SET(VC_SRC
> includes.hh
> ...
> )
>
> Then I added the SET_SOURCE_FILES_PROPERTIES like:
>
> SET_SOURCE_FILES_PROPERTIES(includes.hh COMPILE_FLAGS -c)
>
> When I rerun cmake, I get the following error:
>
> CMake Error: Source file
> "/home/lemmy/research/VisualCortex/src/includes.hh" has unknown type.
>
> (The error code is 255).
>
> Ok, so it seems CMake does not support my prefered header extension. I
> changed it to .hpp and cmake did not complain. But it also did compile
> my header file. I am using GNU C++ compiler.
Do you mean "did not compile my header file"?
Anyway, precompiled headers don't work that way. You cannot just
compile them to object files. You have to have a compiler that supports
precompiled headers. Then read the documentation of that compiler to
find the flag to enable precompiled header support. A precompiled
header is more of a "preparsed" header. The compiler just stores a file
somewhere that lets it load the pre-parsed header quickly.
-Brad
More information about the CMake
mailing list