Details

    Description

      qmake projects can have

      # example.pro
      
      QT += core gui
      
      greaterThan(QT_MAJOR_VERSION, 4) {
        QT += widgets
      }
      

      which pro2cmake.py converts to

      # CMakeLists.txt
      
      find_package(Qt6 COMPONENTS Core)
      find_package(Qt6 COMPONENTS Gui)
      
      if((QT_MAJOR_VERSION GREATER 4))
      
          # should be added here by pro2cmake.py
          #find_package(Qt6 COMPONENTS Widgets)
      
          target_link_libraries(qt6-hello-world PUBLIC
              Qt::Widgets
          )
      endif()
      

      but QT_MAJOR_VERSION is not set

      test:

      # CMakeLists.txt
      
      message("debug: QT_MAJOR_VERSION = ${QT_MAJOR_VERSION}")
      message("debug: QT_VERSION = ${QT_VERSION}")
      message("debug: QT_PACKAGE_VERSION = ${QT_PACKAGE_VERSION}")
      message("debug: QT_DEFAULT_MAJOR_VERSION = ${QT_DEFAULT_MAJOR_VERSION}")
      

      result:

      debug: QT_MAJOR_VERSION = 
      debug: QT_VERSION = 
      debug: QT_PACKAGE_VERSION = 
      debug: QT_DEFAULT_MAJOR_VERSION = 6
      

      alternative: in pro2cmake.py, translate QT_MAJOR_VERSION to QT_DEFAULT_MAJOR_VERSION

      Attachments

        For Gerrit Dashboard: QTBUG-98852
        # Subject Branch Project Status CR V

        Activity

          People

            jbornema Joerg Bornemann
            milahu milan hauth
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes