Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Determine which qt libraries/modules are available [qmake]
QtWS25 Last Chance

Determine which qt libraries/modules are available [qmake]

Scheduled Pinned Locked Moved Installation and Deployment
5 Posts 2 Posters 6.4k Views
  • 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.
  • C Offline
    C Offline
    chdinh
    wrote on last edited by
    #1

    Is there a clean way to detect within a pro file which qt libraries/modules (e.g. 3d, gui) are available?
    We have a project which consists of several subprojects. Some of the subprojects need to be configured with the 3d module or the gui lib.
    Given the qt libraries are build with the option –no-gui and no Qt3d module; We still want to have subprojects build which don’t depend on those (3d, gui) libraries.
    Is there a chance qmake can make this configuration automatically? I think REQUIRES http://qt-project.org/doc/qt-5.0/qmake-variable-reference.html#requires is going in the right direction, but I couldn’t figure out how to use it exactly for this purpose. Do you have any suggestions?

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      I think it's possible in CMake. I don't know of any built-in mechanism like that in qmake, but you can always get around it by declaring a few new variables. For example, declare isGui and isQt3d in some .pri file that you include in your projects. Then, wrap the parts of code that require the gui in:
      @
      isGui {
      QT += gui
      SOURCES += ...
      }
      @

      And build your project with or without those flags depending on the situation. Not a fully automated solution, but might partially solve the problem.

      (Z(:^

      1 Reply Last reply
      0
      • sierdzioS Offline
        sierdzioS Offline
        sierdzio
        Moderators
        wrote on last edited by
        #3

        Ah, what a coincidence. A recent post on Qt Creator mailing list has a nice clue that could help you:
        @
        exists(path/file.pro) {
        SUBDIRS += file
        }
        @

        Again, not exactly what you need, but might solve the issue.

        (Z(:^

        1 Reply Last reply
        0
        • C Offline
          C Offline
          chdinh
          wrote on last edited by
          #4

          Thank you for your Ideas - They are much appreciated!

          1 Reply Last reply
          0
          • C Offline
            C Offline
            chdinh
            wrote on last edited by
            #5

            We found a neat solution. It seems there is this new qmake function "qtHaveModule(<module>): ..." recently introduced. So we solved the problem by utilizing:

            qtHaveModule(3d): ...

            or

            qtHaveModule(3d) {
            ...
            }

            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