> That is an implementation detail. It should not make a difference
> whether the precompiled header is used through your existing header or
> through an autogenerated header that forward includes your existing
> header. This forward inclusion is important at least for GCC: The
> compiler searches for a .gch file in the same directory as the header
> file. Since we do not want this .gch file to be generated in the
> source directory for out-of-source builds, we need to put the header
> file into the build directory.
>
> Did I misunderstand your request and you meant "use an existing
> *precompiled* header", ie. provide a .pch or .gch file?
> My approach currently does not support that. Please let me know if
> that is what you meant.
Right now Peter Kümmel's solution works perfectly for us, with GCC, thanks to 
the object location property. A similar concept can easily solve this 
implementation detail without the need for a CMake generated header. We really 
hope we will have the option of not having these headers in the binary folder.

By existing precompiled header I mean: 
https://git.reactos.org/?p=reactos.git;a=blob;f=reactos/base/applications/calc/CMakeLists.txt;h=85332bd76ea9f1e6cbcfee7d09929a3460083f50;hb=HEAD#l23

As you can see, calc.h is a header perfectly suitable for PCH creation. All our 
targets (that use PCH) have headers like that.

Here's the GCC bit BTW: 
https://git.reactos.org/?p=reactos.git;a=blob;f=reactos/cmake/gcc.cmake;h=25c451ccd2979efeddd721784c12fed68b1ed604;hb=HEAD#l395

> One request that I can add:
>
> * It shall be visible in the IDE's settings that precompiled headers are used.
Sounds good. We already have that for VS so far (the VS flags mappings in CMake 
show you PCH use in the VS projects' properties) and we don't use any other 
IDEs so I can't speak of the rest.
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

Reply via email to