Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Exam question about qmake, just for advance users.
Forum Updated to NodeBB v4.3 + New Features

Exam question about qmake, just for advance users.

Scheduled Pinned Locked Moved Qt Creator and other tools
qmake subdirs c
6 Posts 2 Posters 1.2k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    bnogal
    wrote on last edited by bnogal
    #1

    What projects will be included if your project file contains the next code:

    TEMPLATE = subdirs
    
    MODELS = $$files(models/*.pro,true)
     
    for(m, MODELS){
        MODEL= $$split(m, "/")
       count(MODEL, 3) {
           SUBDIRS += $$m
       }
    }
    

    A) All the projects recursively inside models
    B) All the projects inside each direct subfolder of folder models

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Do you mean you want to know what this should be doing because you got it as a question in an exam ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • B Offline
        B Offline
        bnogal
        wrote on last edited by
        #3

        not really, i found it writting the building code for one of my projects.

        I really cant find the logic.....

        The result is the (A)
        And for more fun, if you print SUBDIRS, it contains exactly the paths as i would be (B)
        if instead of:
        SUBDIRS += $$m

        i write:
        SUBDIRS += $$member(MODEL,0)/$$member(MODEL,1)/$$member(MODEL,2)

        it works.

        i must miss a basic about qmake or i must miss a basic about logic.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by SGaist
          #4

          It's because you are trying to get files that match the "models/*.pro" pattern which is not the same as retrieving files from a folder named models and its subfolders following the pattern "*.pro"

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • B Offline
            B Offline
            bnogal
            wrote on last edited by bnogal
            #5

            that is what i pretend with the $files, as i didnt find a better way.

            and what i pretend with the loop for, is to check which ones, splitting it by "/", give 3 parts:

            1. "model"
            2. folder
            3. files".pro"

            If i use:
            $$m,
            it adds to SUBDIRS the ones i want, but QtCreator is adding everything

            If i add:
            $$member(MODEL,0)/$$member(MODEL,1)/$$member(MODEL,2)

            it adds the sameones to SUBDIRS, but QtCreator detect almost just the ones in SUBDIRS (a couple more than shouldnt)

            As i realized, when try to build it, it seems to process only the correct ones... (the Makefile is correct!) so i believe there is a bug in QtCreator. Can be?

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              If you mean that Qt Creator shows all of your subdirs while only part of them are built then no, its not a bug (well I don't see it as a bug). AFAIK, Qt Creator shows the complete source tree

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved