Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-92982

Add Qt version as target property to Qt::Core

    XMLWordPrintable

    Details

    • Type: Suggestion
    • Status: Reported
    • Priority: P3: Somewhat important
    • Resolution: Unresolved
    • Affects Version/s: 6.1.0 Beta3
    • Fix Version/s: None
    • Component/s: Build System: CMake
    • Labels:
    • Platform/s:
      All

      Description

      It's currently not (easily) possible to determine Qt's version from Qt's CMake targets.

      CMake code like this

      function(load_my_packages)
          find_package(Qt6 COMPONENTS Core)
      endfunction()
      
      load_my_packages()
      

      will load Qt6::Core, but Qt's version will be written into variables that stay within the function's scope. It would be nice to be able to retrieve the Qt version from some target property of Qt6::Core.

      This came up when working on https://gitlab.kitware.com/cmake/cmake/-/issues/22028 which requires executing moc to retrieve Qt's version.

        Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            qtbuildsystem Qt Build System Team
            Reporter:
            jbornema Joerg Bornemann
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There are no open Gerrit changes