Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. qmake and Qt installation root directory
QtWS25 Last Chance

qmake and Qt installation root directory

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 3.5k 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.
  • Swen LaurS Offline
    Swen LaurS Offline
    Swen Laur
    wrote on last edited by
    #1

    How could I refer to Qt installation root directory available in shell as qmake -v. Is there a special qmake variable or a way to store the outcome of qmake -v in a variable.

    1 Reply Last reply
    0
    • Paul ColbyP Offline
      Paul ColbyP Offline
      Paul Colby
      wrote on last edited by Paul Colby
      #2

      Hi @Swen-Laur,

      Is there a special qmake variable or a way to store the outcome of qmake -v in a variable.

      Assuming you want to store the outcome in a qmake variable (as opposed to, for example, a shell script variable), then there's a few built-in variables that probably have what you're after.

      From http://doc.qt.io/qt-5/qmake-language.html#accessing-qmake-properties:

      The special $$[...] operator can be used to access qmake properties

      So, for example:

      paul@paul-XPS-13-9343:~/tmp$ cat messages.pro 
      message(Qt version: $$[QT_VERSION])
      message(Qt is installed in $$[QT_INSTALL_PREFIX])
      message(Qt resources can be found in the following locations:)
      message(Documentation: $$[QT_INSTALL_DOCS])
      message(Header files: $$[QT_INSTALL_HEADERS])
      message(Libraries: $$[QT_INSTALL_LIBS])
      message(Binary files (executables): $$[QT_INSTALL_BINS])
      message(Plugins: $$[QT_INSTALL_PLUGINS])
      message(Data files: $$[QT_INSTALL_DATA])
      message(Translation files: $$[QT_INSTALL_TRANSLATIONS])
      message(Settings: $$[QT_INSTALL_CONFIGURATION])
      message(Examples: $$[QT_INSTALL_EXAMPLES])
      paul@paul-XPS-13-9343:~/tmp$ qmake
      Project MESSAGE: Qt version: 5.4.2
      Project MESSAGE: Qt is installed in /usr
      Project MESSAGE: Qt resources can be found in the following locations:
      Project MESSAGE: Documentation: /usr/share/qt5/doc
      Project MESSAGE: Header files: /usr/include/x86_64-linux-gnu/qt5
      Project MESSAGE: Libraries: /usr/lib/x86_64-linux-gnu
      Project MESSAGE: Binary files (executables): /usr/lib/x86_64-linux-gnu/qt5/bin
      Project MESSAGE: Plugins: /usr/lib/x86_64-linux-gnu/qt5/plugins
      Project MESSAGE: Data files: /usr/share/qt5
      Project MESSAGE: Translation files: /usr/share/qt5/translations
      Project MESSAGE: Settings: /etc/xdg
      Project MESSAGE: Examples: /usr/lib/x86_64-linux-gnu/qt5/examples
      paul@paul-XPS-13-9343:~/tmp$ qmake -v
      QMake version 3.0
      Using Qt version 5.4.2 in /usr/lib/x86_64-linux-gnu
      

      So, at least on my installation, it looks like $$[QT_INSTALL_LIBS] is equivalent to the path given in qmake -v.

      Just out of curiosity, what you want that value for?

      Cheers,

      pc.

      1 Reply Last reply
      1
      • Paul ColbyP Offline
        Paul ColbyP Offline
        Paul Colby
        wrote on last edited by
        #3

        Please note, in my post above, all the instances of [ should be preceded by two $ chars, not one... for some reason this forum (or my browser) keeps switching between showing one and two.

        For example, they should look like $ $ [QT_...] (ignoring the spaces).

        If in doubt, just look at the examples in http://doc.qt.io/qt-5/qmake-language.html#accessing-qmake-properties - they're formatted correctly.

        Cheers.

        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