I have a cross-platform project written in Qt/C++, this project uses a static library that is written in Go as a dependency. Go project generates two files (.a and .h as expected) using GNU Make.
I am trying to automate builds for which I am using qmake to generate Makefile and then calling default target of this Makefile as simple $ make.
Right now my build first explicitly does git clone go-subproject && cd go-subproject && make, then it copies over resulting library and headers file and only then calls git clone qt-project && qmake && make (note that those are not exact commands, these are just simplified explanation of what I am doing right now).
I can include subproject as git module, so that it will automatically get latest code of subproject when doing git clone qt-project.
For that to work How do I instruct .pro file to generate Makefile that will first build subproject?
UPDATE:
Seems the structure is not clear from the question. Here is some visualization of how structure would look like:
/
|
+- .git/
|
+- qt-project.pro
|
+- go-project/
| |
| +- .git/
| |
| +- Makefile
So with the above structure I would like to build entire project with just $ qmake && make
What code would I need to have in my qt-project.pro that would do that?
After searching for a correct answer I found the solution myself. This can be done with
QMAKE_EXTRA_TARGETSandPRE_TARGETDEPSvariables and defining custom targets. Such as for the project described above:In my
.profile:The
QMAKE_EXTRA_TARGETSwill add the additional target with specified commands to the produced Makefile andPRE_TARGETDEPSwill add this target as a dependency to the whole project.