I have a Qt project that contains many sub-projects. I'm having an issue where one of the projects generates files (.cpp and .h files) that are used in a few of the other projects. Here's an example of the directory structure:
src
\- master.pro
\- project1
\- project1.pro
- myHeader.h <generated AFTER project1.pro runs>
- mySource.cpp <generated AFTER project1.pro runs>
\- project2
\- project2.pro <needs to include mySource.cpp>
- main.cpp <includes myHeader.h>
\- project3
\- project3.pro <needs to include mySource.cpp>
- main.cpp <includes myHeader.h>
To be a little more specific, project2
and project3
above are actually server and client projects respectively and they use RPC calls to communicate between the two programs. To generate the RPC files needed by both project2/3 above I created project1
to run the midl.exe compiler commands.
If I compile project1
first manually, then compile project2
and project3
manually then everything works fine. However, if I put the three projects into a Qt subdirs
project and have project2/3 dependent on project1 it doesn't work. The issue being that when qmake is run on project2/3 the generated files don't exist yet, but these files DO exist after project1 actually compiles.
So is there a way to somehow put all three of these projects into one subdirs project and somehow 'defer' the qmake on the dependent projects? or maybe make it so the dependent projects know that those files may not exist at the time of qmake, but will exist at the time of compiling?
Thanks in advance for any advice.
Edit
Just a little more info. Here is what my master.pro
file looks like
TEMPLATE = subdirs
SUBDIRS += project1 project2 project3
project1.file = $$PWD/project1/project1.pro
project2.file = $$PWD/project2/project2.pro
project2.depends = project1
project3.file = $$PWD/project3/project3.pro
project3.depends = project1