Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    Determine which qt libraries/modules are available [qmake]

    Installation and Deployment
    2
    5
    5748
    Loading More Posts
    • 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
      chdinh last edited by

      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 Reply Quote 0
      • sierdzio
        sierdzio Moderators last edited by

        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 Reply Quote 0
        • sierdzio
          sierdzio Moderators last edited by

          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 Reply Quote 0
          • C
            chdinh last edited by

            Thank you for your Ideas - They are much appreciated!

            1 Reply Last reply Reply Quote 0
            • C
              chdinh last edited by

              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 Reply Quote 0
              • First post
                Last post