I\'ve been using Qt Creator for a while now and my project is getting large enough that I\'d like to move to using Qt\'s SUBDIRS template type to better organize my growing
Not all of my projects ready to run the code, how can I select one project to run, having subdir root project?
You can maintain several TEMPLATE = app projects to start parts of your code, say, unit tests for selected libraries as well as the entire app GUI starter. And try to isolate as much of shared code possible in TEMPLATE = lib types of projects. Whether the lib type of project needs to be a static library or dynamic with DEFINES += SHAREDLIB_LIBRARY is another question and the answer depends on how you distribute the app. I maintain my current subdir project with many dynamic libraries to prevent them being linked to executable all the time due to memory restrictions.
Open 'Projects' menu and make sure that Run Configuration points to your application project that contains main function and has:
# app.pro file contains
TEMPLATE = app
and also
# unit_test1.pro file contains
TEMPLATE = app
If some of your projects won't compile, exclude it from subdirs project:
TEMPLATE = subdirs
SUBDIRS = lib unit-test
# SUBDIRS = lib unit-test app # app not ready
# app.depends = lib # may exclude dependcies
unit-test.depends = lib
Mind 'Run configuration' choice of started projects below:
P.S. Don't forget to run qmake after project file changed.
Just create your "master-app". Then edit the .pro File from these app:
TEMPLATE = subdirs
but before you do anything else! This is important!
You can remove all the sourcefiles
SOURCES += \ ...
HEADERS += \ ...
FORMS += \ ...
etc
But this is your master-app! Just the profile! ok, and yourappname.pro.user ;-) Later you can add f.e. an window-app.
Then you can create an another project, f.e. a dll. For this new subbroject you can choose any directory you want :-)
For add: click on the "master-app" right mousebutton and chosse "Add subproject" from the contextmenu.
The last step, before you close the "new subproject-dialog" you should select the master project in a combobox.
That's it! More is not nessesary