I am trying to migrate our Qt projects. Our code is split into 4 libraries and 3 executables.
So for the Torizon I added all to one project, like this.
TEMPLATE = subdirs
CONFIG += ordered
SUBDIRS += MwBase \ # lib
MwData \ #lib
MwModule \ #lib
MwConnection \ #lib
TqCal #tool
When building the project the makefile, binaries and so on are generated but at the install step I always get : make[1]: Nothing to be done for ‘install’
For me, it seems like QMAKE_DESTIDIR is only passed to the main .pro file and not the subprojects. So the appconfig_0/work folder stays empty.
What is the best way to build a project with multiple libs and tools?
Hi @awidemann ,
Welcome to our community! Feel free to explore other topics of interest.
Have you added the
DESTDIR = $$(QMAKE_DESTIDIR)
directive to your project file, as mentioned in this article in our developer page?
While not specifically about Qt SUBDIRS templates, the article and this blog post have more general information on how to import an existing Qt5 project that should help you migrate your applications.
Take a look at the references above and see if they help you.
Best regards,
Lucas Akira
HI @lucas_a.tx ,
thank you for the quick reply.
Yes, i added this line to the main Project and also to the subprojects.
I also added a print command to all projects
TEMPLATE = subdirs
CONFIG += ordered
SUBDIRS += MwBase \
MwData \
MwModule \
MwConnection \
TqCal
DESTDIR = $$(QMAKE_DESTIDIR)
message(Torizon target dir: $$(QMAKE_DESTIDIR))
When i compile it, I can see that the subprojects won’t get this passed through.
* Task wird ausgeführt: aarch64-linux-gnu-qmake CONFIG+=debug
Project MESSAGE: Torizon target dir: /workspaces/smu/src/appconfig_0/work/src
* Das Terminal wird von Aufgaben wiederverwendet, drücken Sie zum Schließen eine beliebige Taste.
* Task wird ausgeführt: aarch64-linux-gnu-qmake CONFIG+=debug
cd MwBase/ && ( test -e Makefile || /usr/lib/qt5/bin/qmake -o Makefile /workspaces/smu/src/MwBase/MwBase.pro -qtconf /usr/lib/aarch64-linux-gnu/qt5/qt.conf -early QMAKE_CC=aarch64-linux-gnu-gcc QMAKE_CXX=aarch64-linux-gnu-g++ QMAKE_LINK=aarch64-linux-gnu-g++ QMAKE_STRIP=aarch64-linux-gnu-strip QMAKE_QMAKE=/usr/bin/aarch64-linux-gnu-qmake PKG_CONFIG=aarch64-linux-gnu-pkg-config -before CONFIG+=debug ) && make -f Makefile
Project MESSAGE: Torizon target dir:
make[1]: Entering directory '/workspaces/smu/src/MwBase'
aarch64-linux-gnu-g++ -c -pipe -g -std=gnu++1z -Wall -Wextra -D_REENTRANT -fPIC -DMWBASE_LIBRARY -DQT_MESSAGELOGCONTEXT -DQT_CORE_LIB -I. -I/usr/include/aarch64-linux-gnu/qt5 -I/usr/include/aarch64-linux-gnu/qt5/QtCore -I. -I/usr/lib/aarch64-linux-gnu/qt5/mkspecs/linux-g++ -o MwBase.o MwBase.cpp
The SerialStudio project is written really great, but the libraries are linked static.
If we switch to static linking, this would also influence our other build platforms.
Best regards,
Alex 
Hi @awidemann ,
From this example SUBDIRS Qt project (GitHub - rainbyte/example-qmake-subdirs: Example of a qmake project with multiple components) adapted to Linux and importing it by following the article referenced previously I was able to confirm that QMAKE_DESTIDIR
is not set by default when handling the subprojects.
To solve this you can change .vscode/tasks.json
in the following way: Add these lines in the tasks labeled build_debug
and build_release
:
"options": {
"env": {
"QMAKE_DESTIDIR": "${command:torizon.ccpp.getTargetFolder}"
}
}
Add a comma before and/or after the lines above depending on where you place it.
As for the make[1]: Nothing to be done for 'install'
message, this probably means that the .pro subprojects don’t have install instructions.
To install things inside appconfig_0/work
you can add something like this for each subproject .pro (remove DESTDIR = $$(QMAKE_DESTIDIR)
before if it is present):
lib1.path = $$(QMAKE_DESTIDIR)
lib1.files = *.so*
INSTALLS += lib1
lib1
can be any name you want (like the subproject name itself), so long as it is unique for each subproject.
You can change .path
to $$(QMAKE_DESTIDIR)/usr/bin
or $$(QMAKE_DESTIDIR)/usr/lib64
to better organize things.
Put every subproject file you want to install in .files
, like *.so*
to put every library file.
You can find more information about these lines in the Qt documentation: Advanced Usage | qmake Manual
With this I was able to set up the example project. Try doing the above and let me know how that goes.
Best regards,
Lucas Akira
Hi @awidemann !
Did you have time to perform the tests?
Let us know if you have news about this topic 
Best regards,
hi @lucas_a.tx and @henrique.tx
Thank you for your Help. I needed to add export LD_LIBRARY_PATH=/src/ as precommand. It is working now as expected, and I will test it out a bit.
I will test it out which solution is better for debugging and productive run. Maybe splitting the projects and executing it as different containers works better for us.
Best Regards
Alex