Hi I am relatively new to Qt and I could not find a viable solution to this so far. I have the following project structure
ALPHA-app
alpha.pro
ALPHA-Desktop
alpha-desktop.pro
ALPHA-Shared
alpha-shared.pro
ALPHA-Common
alpha-common.pro
ALPHA-Tests
alpha-tests.pro
I basically have to run alpha.pro which builds all the projects and creates an executable
alpha.pro,
TEMPLATE = subdirs
DESTDIR = .
SUBDIRS += \
ALPHA-Common \
ALPHA-Shared \
ALPHA-Desktop \
ALPHA-Tests
ALPHA-Desktop.depends = ALPHA-Common
ALPHA-Shared.depends = ALPHA-Common
ALPHA-Tests.depends = ALPHA-Common
ALPHA-Tests.depends = ALPHA-Desktop
the main executable that will be run is present in the ALPHA-Desktop project (given below)
TARGET = ALPHA #this is in ALPHA-Deskop.pro
TEMPLATE = app
Now I created ALPHA-Tests to make a project to run unit-tests. It depends on ALPHA-Desktop (Hence I wrote the .depends statement in the ALPHA project)
To run the ALPHA-Tests, I need to create a static library of the ALPHA-Desktop folder. Hence I wrote the following lines in ALPHA-Desktop.pro file
TARGET = ALPHA-Desktop #section 1
TEMPLATE = lib #section 1
CONFIG += staticlib #section 1
TARGET = ALPHA #section 2
TEMPLATE = app #section 2
When I run the ALPHA.pro file, the ALPHA-Desktop library is not getting created. Only the ALPHA executable is being created. If I interchange the positions (i.e., put section 2 above section 1) then only the libALPHA-Desktop.a file is created and the executable is not created.
How do I solve this? (I am using qmake version 3.0, Qt version 5.4.2 on ubuntu 15.10)