Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-28897

Conan auto-setup misinterprets QtCreator.ini

    XMLWordPrintable

Details

    • macOS

    Description

      I have Qt 6.4.1 and Qt Creator 9.0.2 installed via the "Qt Maintenance Tool".
      When configuring a CMake project I see this error:

      Running /usr/local/Cellar/cmake/3.25.3/bin/cmake -S /Users/xxx/proj/yyy -B /Users/xxx/proj/yyy/.build-Debug -DCMAKE_GENERATOR:STRING=Ninja -DCMAKE_BUILD_TYPE:STRING=Debug '-DCMAKE_PROJECT_INCLUDE_BEFORE:FILEPATH=/Users/xxx/sdk/Qt/Qt Creator.app/Contents/Resources/package-manager/auto-setup.cmake' -DQT_QMAKE_EXECUTABLE:FILEPATH=/Users/xxx/sdk/Qt/6.4.1/macos/bin/qmake '-DCMAKE_PREFIX_PATH:PATH=/Users/xxx/sdk/Qt/6.4.1/macos;/Users/xxx/sdk/Qt/Qt Creator.app/Contents/Resources' -DCMAKE_C_COMPILER:FILEPATH=/usr/bin/clang -DCMAKE_CXX_COMPILER:FILEPATH=/usr/bin/clang++ -DCMAKE_CXX_FLAGS_INIT:STRING= in /Users/xxx/proj/yyy/.build-Debug.
      CMake Error at /Users/xxx/sdk/Qt/Qt Creator.app/Contents/Resources/package-manager/auto-setup.cmake:44 (file):
      file STRINGS file
      "/Users/xxx/proj/yyy/../../../Tools/sdktool/QtProject/QtCreator.ini"
      cannot be read.
      Call Stack (most recent call first):
      /Users/xxx/sdk/Qt/Qt Creator.app/Contents/Resources/package-manager/auto-setup.cmake:134 (qtc_auto_setup_conan)
      CMakeLists.txt:3 (project)

      The CMake script `Qt/Qt Creator.app/Contents/Resources/package-manager/auto-setup.cmake:40` reads the value `InstallSettings` from `/Users/xxx/sdk/Qt/Qt Creator.app/Contents/Resources/QtProject/QtCreator.ini` which is equal to `../../../Tools/sdktool` (I did not touch this file, so it must have been written like this by the installer), the script then tries to follow this path to load the next INI file but instead of resolving the path relative to the initial INI file it uses the path as is:

      set(qt_creator_ini "${install_settings}/QtProject/QtCreator.ini")
      file(TO_CMAKE_PATH "${qt_creator_ini}" qt_creator_ini)

      which gets resolved relative to the currently open project, which makes no sense.
      The path should probably be resolved relative to the first INI file e.g. like the following (adding this at line 40):

      cmake_path(ABSOLUTE_PATH install_settings
      BASE_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/../QtProject/"
      OUTPUT_VARIABLE install_settings
      )

      it would ALMOST correctly resolve to the right file `/Users/xxx/sdk/Qt/Tools/sdktool/QtProject/QtCreator.ini` which is there for me, but unfortunately the InstallSettings relative path in the first INI file is still missing one more "../" to get it right

      Attachments

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

        Activity

          People

            cadam Cristian Adam
            knuckles Max Breev
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes