[ros-dev] 52061 [jgardou] [CMAKE], "According to gcc doc, if header.h is precompiled, the output should be named "header.h.gch" and not anything else.", Knowing it was the first step before actually doing it :-/

Colin Finck colin at reactos.org
Thu Jun 2 20:42:16 UTC 2011


jgardou at svn.reactos.org wrote:
 > -  set(_gch_filename "${_target_name}_${_FILE}.gch")
 > +  set(_gch_filename "${_FILE}.gch")

Looks like we're going through the same mess of GNU precompiled headers, 
which we already had in rbuild:

1) Giving the GCH file a custom name.
    Problem: It is simply ignored in the build process.
2) Just renaming it to the name of the header file.
    Problem: If two modules use the same header file with different
    build options (like #defines), the compiler can only choose one
    precompiled header and we have a corrupted build.

The solution now is to give every GCH file an individual directory whose 
name contains the module name (like ".gch_smlib", this is what we 
currently have in rbuild).

Concluding from what I see in rbuild, please also note that the GCH file 
needs to be named "header.h.gch", not "header.gch". Your ${basename} 
variable sounds like this is not done either in the CMake branch.


- Colin



More information about the Ros-dev mailing list