SGbo
SGbo

Reputation: 344

Qt project structure

I want to structure my project in Qt-Creator like this:

MainProject
  main.pro
  SubProject
    sub.pro
    SubSubIncludes
      subsub.pri

I tried to achive this by creating the project- and include-files like this:

main.pro

include(subproject/subproject.pro)

subproject.pro

include(subsubincludes/subsubincludes.pri)

What now happens is, that the subsubincludes folder is included to the MainProject instead of to the SubProject like this:

MainProject
  main.pro
  SubSubIncludes // WRONG INCLUDE
      subsub.pri // ALSO WRONG
  SubProject
    sub.pro

Upvotes: 3

Views: 3432

Answers (1)

SGbo
SGbo

Reputation: 344

As suggested by sashoalm I used the Qt Creator's Subdirs project wizard and copied the things I needed.

You can find the Wizard at:

"File" -> "New File or Project..." -> "Other Project" -> "Subdirs Project"

In the created you can add subprojects by right-click on the .pro file and afterwards click on "New Subproject".

In my case I needed to modify my existing project. Therefore I just had to add/modify the TEMPLATE define in the top-level-project-file(.pro) and the SUBDIRS define like follows:

TEMPLATE = subdirs
SUBDIRS += NAME_OF_SUBDIR_PROJECT_FOLDER

Upvotes: 4

Related Questions