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

Cannot build the target with CMakePresets.json using releative path of C/C++ compilers to env PATH.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Not Evaluated
    • Qt Creator 9.0.2
    • Qt Creator 9.0.0
    • None
    • Windows 11
      CMake 3.24.0
      MinGW 8.1.0
      Ninja 1.11.1
      Qt Creator 9.0.0
      CLion 2022.3
      VSCode 1.74.1
      CMake Tools 1.13.29
    • Windows
    • 70b338868 (9.0)

    Description

      Problem Description

      The following example CMakePresets.json can work with VSCode (CMake Tools) and CLion. However, QtCreator "cannot" do so. Hope QtCreator can fix it.

      CMakePresets.json:

      {
        "version": 3,
        "cmakeMinimumRequired": {
          "major": 3,
          "minor": 21,
          "patch": 0
        },
        "configurePresets": [
          {
            "name": "win32-mingw-gcc-x64-ninja-debug",
            "displayName": "Windows MinGW GCC x64 (Ninja) Debug",
            "description": "Using MinGW GCC x64 compiler with \"Ninja\" generator on Windows - Debug",
            "generator": "Ninja",
            "environment": {
              "PATH": "C:\\Qt\\Tools\\mingw810_64\\bin;$penv{PATH}"
            },
            "cmakeExecutable": "C:/Program Files/CMake/bin/cmake.exe",
            "binaryDir": "${sourceDir}/build/${presetName}",
            "installDir": "${sourceDir}/install/${presetName}",
            "cacheVariables": {
              "CMAKE_C_COMPILER": "gcc.exe",
              "CMAKE_CXX_COMPILER": "g++.exe",
              "CMAKE_BUILD_TYPE": "Debug"
            }
          }
        ]
      }
      

      Error Messages

      The following is the error message when building the target in Qt Creator.

      14:40:08: Running steps for project test-cmake-preset-mingw...
      14:40:08: Starting: "C:\Program Files\CMake\bin\cmake.exe" --build F:/GitRepo/tmp/test-cmake-preset-mingw/build/win32-mingw-gcc-x64-ninja-debug --target main
      [1/2 45.5/sec] Building CXX object CMakeFiles/main.dir/main.cpp.obj
      FAILED: CMakeFiles/main.dir/main.cpp.obj 
      C:\Qt\Tools\mingw810_64\bin\g++.exe   -g -MD -MT CMakeFiles/main.dir/main.cpp.obj -MF CMakeFiles\main.dir\main.cpp.obj.d -o CMakeFiles/main.dir/main.cpp.obj -c F:/GitRepo/tmp/test-cmake-preset-mingw/main.cpp
      ninja: build stopped: subcommand failed.
      14:40:08: The process "C:\Program Files\CMake\bin\cmake.exe" exited with code 1.
      Error while building/deploying project test-cmake-preset-mingw (kit: Windows MinGW GCC x64 (Ninja) Debug (CMake preset))
      The kit Windows MinGW GCC x64 (Ninja) Debug (CMake preset) has configuration issues which might be the root cause for this problem.
      When executing step "Build"
      14:40:08: Elapsed time: 00:00.

      Screenshots and GIFs

       

       

      Attachments

        1. compare-cmakes.png
          compare-cmakes.png
          13 kB
        2. demo-clion.gif
          demo-clion.gif
          685 kB
        3. demo-qtcreator.gif
          demo-qtcreator.gif
          648 kB
        4. demo-vscode.gif
          demo-vscode.gif
          716 kB
        5. feature-request.png
          feature-request.png
          29 kB
        6. qtcreator-mingw-preset.gif
          qtcreator-mingw-preset.gif
          1.65 MB
        7. qtcreator-mingw-preset-relative-path.gif
          qtcreator-mingw-preset-relative-path.gif
          1.57 MB
        8. remove-previous-kits.gif
          remove-previous-kits.gif
          2.02 MB
        9. still-failed.png
          still-failed.png
          104 kB
        10. test-cmake-preset-mingw.zip
          6 kB
        11. use-bundled-cmake.gif
          use-bundled-cmake.gif
          2.09 MB

        Issue Links

          Activity

            People

              cadam Cristian Adam
              hwhsu1231 Haowei Hsu
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: