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

uninformative error message on missing cmake_minimum_required in user projects

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • None
    • 6.0.0 Beta4
    • Build System: CMake

    Description

      Suppose a user creates a Qt-based project with a CMakeLists.txt that is missing a call to cmake_minimum_required(VERSION 3.17) or higher.

      Then a call like find_package(Qt6 COMPONENTS Core) will produce the following error

      CMake Error at /home/jobor/Qt/dev-cmake/lib/cmake/Qt6/Qt6Dependencies.cmake:14 (list):
        list index: 3 out of range (-2, 1)
      Call Stack (most recent call first):
        /home/jobor/Qt/dev-cmake/lib/cmake/Qt6/Qt6Config.cmake:69 (include)
        CMakeLists.txt:4 (find_package)
      

      instead of something more enlightening like "CMake version so-and-so required".

      Solution: make sure that we do not access list elements beyond the list's end in the exported files.
      The exported cmake files should work without setting policies / requiring any newer CMake features.

      Attachments

        Issue Links

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

          Activity

            People

              jbornema Joerg Bornemann
              jbornema Joerg Bornemann
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes