Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Adding projects to SUB_DIRS - order / selection of execution ?
AnneRanch last edited by
As a test excise
I have build new "subproject" and added as main project QWidgetApplication .
Works as expected - runs and shows "main" window.
Now I have added - as first subproject another QWidgetApplication .
When run the newly added project executes and its window shows.
At this point I am asking - what instructs the qmake(s) to actually select the project to run?
The I have added several more SAME type of projects , last one being project "SUBDIR_A.
In process of adding more subdirs project I managed to get the main , first added, project to ALWAYS execute.
According to documentation SUBDIRS are "build" in order of dependency - if library is added it is build BEFORE project where it is used. ( I am not disputing that)
From this exercise so far
- projects are added to subdir main project file in an alphabetical order
- there are no "TEMPLATE=app" in any of the added .pro files
So the question is
what determines which project out of several identical projects ( all have main.cpp)
will be run?
Here is my current main project file - and the SUBDISR_MAIN_PROJECT executes
TEMPLATE = subdirs message(processing main project file ) SUBDIRS += \ # SUBDIRS_FIRST_SUBPROJECT \ SUBDIRS_A \ SUBDIRS_MAIN_PROJECT \ SUBDIRS_FIRST_SUBPROJECT \ SUBDIRS_THIRD_project \ SUNBIRS_SECOND_project CONFIG =ordered
PS Adding CONFIG - expecting SUBDIRS_A to run - did not change - still executing SUBDIR_MAIN_PROJECT
qmake has nothing to do with which executable is run. It's in Qt Creator. Take a look at the computer icon that is just above the Run arrow. You can select there which project you will run from your sub-project.
AnneRanch last edited by
@SGaist I generally shy away from GUI , many because some of them are just poor and often incomplete copy / modification of CLI, and never payed attention to the strip of icons you are referring to. I use "Project" -> Run and when used in SUB_DIRS it apparently has no means to select the project. Will learn to live wit that.
AnneRanch last edited by AnneRanch
I found this
Creating Run Configurations for Subprojects
To prevent Qt Creator from automatically creating run configurations for SUBDIRS projects, specify the following variable in the .pro file of the SUBDIRS project: CONFIG += qtc_runnable.
Qt Creator creates run configurations only for subprojects that also have CONFIG += qtc_runnable set in their .pro files.
However, after using the "big icon" adding CONFIG to both SUBDIR .pro and the project I want to run I still run the project selected by the icon.
How do I "clear" the "icon" selection to test the CONFIG?
let me say this - it somebody can point me to "purpose of the LEFT big icons" documentation I am game. It appears to be a "cute GUI" afterthought / replacement for "F1" help. ( There seems to be some relations to plain "options"... )
I find it "interesting" how SUB_DIRS options are so scattered throughout Qt documentation. qmake docs covers how to setup sequence of its works , but one have to use "big icons" to find out how to actually select which SUB_DIRS project. to execute. There is something missing in philosophy of SUB_DIRS here.
And in the process discovering "dependencies" .... ( next project - how to verify that these options are actually working ...)
Personally - I would prefer all these "big icons " options to be part of the standard window style menu driven scheme.