0

I would like to clean compile another different source and install its libraries, before qmake executes its own execution to build the main target. The following link explains it very well, but the problem I have is that I want to generate multiple header files and library, and I want that build to block qmake operation. It seems to me that using neither approach blocks main qmake execution.

PRE_TARGETDEPS fails when using parallel builds

Approach 1 (main-app.pro):

...
extralib.target = extra
extralib.commands = cd $$ANOTHER_PROJECT_DIR; \   
                    make clean && make && make install; \

extralib.depends = FORCE
QMAKE_EXTRA_TARGETS += extralib
PRE_TARGETDEPS = extra

Approach 2 (main-app.pro):

...
TO_GENERATE = $$HOME/myapi/include/a.h $$HOME/myapi/include/b.h

custom_generator.output  = $$HOME/myapi/include/a.h $$HOME/myapi/include/b.h
custom_generator.commands = cd $$ANOTHER_PROJECT_DIR; \
                            make clean && make && make install;
custom_generator.depends = FORCE
custom_generator.input = TO_GENERATE
custom_generator.variable_out = SOURCES
QMAKE_EXTRA_COMPILERS += custom_generator

Prior to everything else, I would like qmake to go into $$ANOTHER_PROJECT_DIR, do make clean && make && make install, creating $$HOME/myapi/lib and $$HOME/myapi/include, which are required for my main build. Keep in mind that I can't use SUBDIRS since library uses GNU Make, and my main build uses QMake.

Currently what happens is library build commands are started, and instantly QMake decides to proceed with the main build, not waiting for library to completely finish building and installing.

Any suggestions are very much appreciated.

mozcelikors
  • 2,582
  • 8
  • 43
  • 77
  • I think a `SUBDIRS` solution will still work. You can use an `aux` template for your extra target, like in [this answer](https://stackoverflow.com/a/16188749/7427152). – JarMan Mar 24 '21 at 13:50
  • Does this answer your question? [qmake: custom step for each make call](https://stackoverflow.com/questions/50035633/qmake-custom-step-for-each-make-call) – Matt Mar 25 '21 at 07:47
  • BTW. PRE_TARGETDEPS does exactly what it says: if your TARGET is myapp and PRE_TARGETDEPS+=extra then resulting Makefile will have the line: `myapp: extra foo bar baz`. Obviously, it will impose the build order only for sequential build, not parallel one. – Matt Mar 25 '21 at 07:50

0 Answers0