tags:

views:

77

answers:

2

Hi All,

I have a big Qt project, splitted on several static libraries (around 70) and one application, and for that I'm using a .pro file with the subdirs template.

To speed up the compilations time, I want to use precompiled headers and found that using the PRECOMPILED_HEADER on each sub-project does the trick, BUT, every project compiles the precompiled header separately (and that one is the slowest step).

There is a way to "share" the precompiled header between all the subprojects included on the subdirs template?, so the precompiled header can be built once, and be used by all subprojects?

Regards

A: 

If each header would be compiled separately to its own pch, then this could work. Unfortunately, as far as I know, in c++ projects there is only one translation unit for the precompiled headers that can be used globally per project. Well, you could use one global file for all your projects, but that is leas effective: this can lead to increased build times, because every time precompiled header is changed EVERYTHING has to be rebuilt.

fmuecke
The idea is that the precompiled header will not change, I want to put all the Qt specific stuff in there and nothing else. But there is way with Qmake to do that global file?
Federico
A: 

Just a suggestion - you might want to try to use cmake. It does have both qt and pch support, and it's current pch support suffers from the same issue. The pch-related macros come in a separate easy to understand file, and can be rewritten to do just one big pch file for many subfolders. This is how I intend to solve the same issue for my qt project.

IggShaman