Skip to content

Non-existent build folder used with doubly inheriting configure preset #4023

@mpayrits

Description

@mpayrits

Brief Issue Summary

With a CMakeUserPresets.json and no CMakePresets.json where the active preset inherits from two hidden presets, the CMake vscode tools build step executes with a made-up, non-existent build folder, and consequently fails.
The specific setup that fails is included in the Additional Information section.
Adding a CMakePresets.json file, even if its configurePresets field is empty, makes the problem go away, as does moving the specification of binaryDir to the default preset.

CMake Tools Diagnostics

{
  "os": "win32",
  "vscodeVersion": "1.92.2",
  "cmtVersion": "1.19.49",
  "configurations": [
    {
      "folder": "c:\\repos\\cmake_repro",
      "cmakeVersion": "3.30.0",
      "configured": true,
      "generator": "Ninja",
      "usesPresets": true,
      "compilers": {
        "CXX": "C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Tools/MSVC/14.40.33807/bin/Hostx64/x64/cl.exe"
      }
    }
  ],
  "cpptoolsIntegration": {
    "isReady": true,
    "hasCodeModel": false,
    "activeBuildType": "",
    "buildTypesSeen": [
      "Debug"
    ],
    "requests": [],
    "responses": [],
    "partialMatches": [],
    "targetCount": 0,
    "executablesCount": 0,
    "librariesCount": 0,
    "targets": []
  },
  "settings": [
    {
      "communicationMode": "automatic",
      "useCMakePresets": "auto",
      "configureOnOpen": true
    }
  ]
}

Debug Log

[main] Building folder: C:/repos/cmake_repro/build/Release 
[main] Saving open files before configure/build
[build] Starting build
[driver] Start build 
[proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" --build C:/repos/cmake_repro/out/build/default-Release --parallel 22 --
[proc]   with environment:  # Deleted by OP
[build] Error: C:/repos/cmake_repro/out/build/default-Release is not a directory
[proc] The command: "C:\Program Files\CMake\bin\cmake.EXE" --build C:/repos/cmake_repro/out/build/default-Release --parallel 22 -- exited with code: 1
[driver] Build completed: 00:00:00.101
[cmakefileapi-parser] Read reply folder: C:\repos\cmake_repro\build\Release\.cmake\api\v1\reply
[cmakefileapi-parser] Found index files: ["cache-v2-6a79af79a33f529f12b0.json","cmakeFiles-v1-e2d2853485946773b423.json","codemodel-v2-ab181b5ee363a1d3bd47.json","directory-.-Debug-d0094a50bb2071803777.json","index-2024-08-29T14-46-54-0792.json","toolchains-v1-d7ac54a936b2bd07920c.json"]
[build] Build finished with exit code 1
[cache] Reading CMake cache file C:/repos/cmake_repro/build/Release/CMakeCache.txt
[cache] Parsing CMake cache string
[extension] [9669] cmake.build finished (returned 1)
[cache] Reading CMake cache file C:/repos/cmake_repro/build/Release/CMakeCache.txt
[cache] Parsing CMake cache string
[cpptools] The build configurations generated do not contain the active build configuration. Using "Debug" for CMAKE_BUILD_TYPE instead of "null" to ensure that IntelliSense configurations can be found

Additional Information

The reproducing project consists of these two files.
CMakeUserPresets.json
CMakeLists.txt
Adding the following trivial file makes the problem go away.
CMakePresets.json

Metadata

Metadata

Assignees

No one assigned

    Labels

    Feature: presetsbuga bug in the productregressionused to work and no longer does. Regressions are typically high priority

    Type

    No type

    Projects

    Status

    Completed

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions