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

uninformative error message on missing cmake_minimum_required in user projects

XMLWordPrintable

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

      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.

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

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

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes