Skip to content

[Bug] issue with CMake 4.1.0 #4575

@JDESTM

Description

@JDESTM

Brief Issue Summary

I'm regularly facing an unrecoverable situation with CMake Tools since few weeks for which I have been able to identify a scenario to reproduce it systematically when pointing to CMake version 4.1.0 (Release Notes)

  1. Open a project which has a CMakeLists.txt issue (without any build directory)
  2. This leads to a cmake-file-api error:
Image
  1. Quit and restart or reload VSCode
  2. Project status and project outline are empty
  3. Run delete cache and reconfigure
  4. An error in repported in CMake/Build output channel: [rollbar] Unhandled exception: Unhandled Promise rejection: cleanConfigure Error: No index file found. {}
  5. Fix the CMakeLists.txt
  6. Run delete cache and reconfigure still reports the same error
  7. Reload/Restart VSCode still report it too

At that point I can't use CMake Tools with my project anymore until I manually remove the build directory, which seems to be the only possible workaround.

CMake Tools Diagnostics

{
  "os": "darwin",
  "vscodeVersion": "1.104.0",
  "cmtVersion": "1.22.9",
  "configurations": [
    {
      "folder": "/xxx/git/cmake-examples/01-basic/A-hello-cmake",
      "cmakeVersion": "unknown",
      "configured": false,
      "generator": "unknown",
      "usesPresets": false,
      "compilers": {}
    }
  ],
  "cpptoolsIntegration": {
    "isReady": false,
    "hasCodeModel": false,
    "activeBuildType": "",
    "buildTypesSeen": [],
    "requests": [],
    "responses": [],
    "partialMatches": [],
    "targetCount": 0,
    "executablesCount": 0,
    "librariesCount": 0,
    "targets": []
  },
  "settings": [
    {
      "communicationMode": "automatic",
      "useCMakePresets": "auto",
      "configureOnOpen": true
    }
  ]
}

Debug Log

[main] Configuring project: A-hello-cmake 
[main] Saving open files before configure/build
[expand] expanded ${workspaceFolder}/build
[driver] Start configure 
[driver] Running pre-configure checks and steps
[driver] Using compilers in Clang 16.0.0 arm64-apple-darwin24.2.0 for configure
[expand] expanded ${workspaceFolder}/build
[cmakefileapi-driver] Configuring using kit
[cmakefileapi-driver] Invoking CMake cmake with arguments ["-DCMAKE_BUILD_TYPE:STRING=Debug","-DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE","-DCMAKE_C_COMPILER:FILEPATH=/usr/bin/clang","-DCMAKE_CXX_COMPILER:FILEPATH=/usr/bin/clang++","--no-warn-unused-cli","-S","/<masked_user_home>/git/cmake-examples/01-basic/A-hello-cmake","-B","/<masked_user_home>/git/cmake-examples/01-basic/A-hello-cmake/build","-G","Ninja"]
[proc] Executing command: "cmake" -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_C_COMPILER:FILEPATH=/usr/bin/clang -DCMAKE_CXX_COMPILER:FILEPATH=/usr/bin/clang++ --no-warn-unused-cli -S /<masked_user_home>/git/cmake-examples/01-basic/A-hello-cmake -B /<masked_user_home>/git/cmake-examples/01-basic/A-hello-cmake/build -G Ninja
[proc]   with environment: {"CHILD_CONCURRENCY":"1","CLICOLOR":"1","COLORTERM":"truecolor","COMMAND_MODE":"unix2003","ELECTRON_NO_ATTACH_CONSOLE":"1","HOME":"/<masked_user_home>","HOMEBREW_CELLAR":"/opt/homebrew/Cellar","HOMEBREW_PREFIX":"/opt/homebrew","HOMEBREW_REPOSITORY":"/opt/homebrew","INFOPATH":"/opt/homebrew/share/info:","LC_ALL":"en_US.UTF-8","LC_CTYPE":"en_US.UTF-8","LOGNAME":"dehaudtj","LSCOLORS":"GxFxCxDxBxegedabagaced","LaunchInstanceID":"A72B62A5-BC89-4ACE-B6F8-8490C8FCC896","MallocNanoZone":"0","NVM_BIN":"/<masked_user_home>/.nvm/versions/node/v20.18.1/bin","NVM_DIR":"/<masked_user_home>/.nvm","NVM_INC":"/<masked_user_home>/.nvm/versions/node/v20.18.1/include/node","ORIGINAL_XDG_CURRENT_DESKTOP":"undefined","OSLogRateLimit":"64","PATH":"/Applications/Visual Studio Code.app/Contents/Resources/app/bin/:/opt/homebrew/bin:/opt/homebrew/sbin:/<masked_user_home>/.nvm/versions/node/v20.18.1/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/<masked_user_home>/bin:/<masked_user_home>/Library/Python/3.9/bin","PUPPETEER_SKIP_CHROMIUM_DOWNLOAD":"1","PUPPETEER_SKIP_DOWNLOAD":"1","PWD":"/<masked_user_home>/git/cmake-examples/01-basic","SHELL":"/bin/bash","SHLVL":"2","SSH_AUTH_SOCK":"/private/tmp/com.apple.launchd.MsNfrmUZ9w/Listeners","TERM":"xterm-256color","TERM_PROGRAM":"Apple_Terminal","TERM_PROGRAM_VERSION":"464","TERM_SESSION_ID":"C206FE1D-8D29-4058-857B-02388AD73375","TMPDIR":"/var/folders/5n/vkxmcnfs0yb0l_4crvl64h2w0000gn/T/","USER":"<masked>","VSCODE_CLI":"1","VSCODE_CODE_CACHE_PATH":"/<masked_user_home>/Library/Application Support/Code/CachedData/f220831ea2d946c0dcb0f3eaa480eb435a2c1260","VSCODE_CRASH_REPORTER_PROCESS_TYPE":"extensionHost","VSCODE_CWD":"/<masked_user_home>/git/cmake-examples/01-basic","VSCODE_ESM_ENTRYPOINT":"vs/workbench/api/node/extensionHostProcess","VSCODE_HANDLES_UNCAUGHT_ERRORS":"true","VSCODE_IPC_HOOK":"/<masked_user_home>/Library/Application Support/Code/1.10-main.sock","VSCODE_NLS_CONFIG":"{\"userLocale\":\"en-us\",\"osLocale\":\"en-us\",\"resolvedLanguage\":\"en\",\"defaultMessagesFile\":\"/Applications/Visual Studio Code.app/Contents/Resources/app/out/nls.messages.json\",\"locale\":\"en-us\",\"availableLanguages\":{}}","VSCODE_PID":"800","XPC_FLAGS":"0x0","XPC_SERVICE_NAME":"application.com.microsoft.VSCode.30206266.30206272.E03B105B-C495-4D0C-952F-E0534C8C9CB1","__CFBundleIdentifier":"com.microsoft.VSCode","__CF_USER_TEXT_ENCODING":"0x1F5:0x0:0x0","APPLICATION_INSIGHTS_NO_STATSBEAT":"true","VSCODE_L10N_BUNDLE_LOCATION":""}
[cmake] Not searching for unused variables given on the command line.
[cmake] CMake Warning (dev) in CMakeLists.txt:
[cmake]   No project() command is present.  The top-level CMakeLists.txt file must
[cmake]   contain a literal, direct call to the project() command.  Add a line of
[cmake]   code such as
[cmake] 
[cmake]     project(ProjectName)
[cmake] 
[cmake]   near the top of the file, but after cmake_minimum_required().
[cmake] 
[cmake]   CMake is pretending there is a "project(Project)" command on the first
[cmake]   line.
[cmake] This warning is for project developers.  Use -Wno-dev to suppress it.
[cmake] 
[cmake] CMake Warning (dev) in CMakeLists.txt:
[cmake]   cmake_minimum_required() should be called prior to this top-level project()
[cmake]   call.  Please see the cmake-commands(7) manual for usage documentation of
[cmake]   both commands.
[cmake] This warning is for project developers.  Use -Wno-dev to suppress it.
[cmake] 
[cmake] -- The C compiler identification is AppleClang 17.0.0.17000319
[cmake] -- The CXX compiler identification is AppleClang 17.0.0.17000319
[cmake] -- Detecting C compiler ABI info
[cmake] -- Detecting C compiler ABI info - done
[cmake] -- Check for working C compiler: /usr/bin/clang - skipped
[cmake] -- Detecting C compile features
[cmake] -- Detecting C compile features - done
[cmake] -- Detecting CXX compiler ABI info
[cmake] -- Detecting CXX compiler ABI info - done
[cmake] -- Check for working CXX compiler: /usr/bin/clang++ - skipped
[cmake] -- Detecting CXX compile features
[cmake] -- Detecting CXX compile features - done
[cmake] CMake Error at CMakeLists.txt:7 (projectt):
[cmake]   Unknown CMake command "projectt".
[cmake] 
[cmake] 
[cmake] -- Configuring incomplete, errors occurred!
[proc] The command: "cmake" -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_C_COMPILER:FILEPATH=/usr/bin/clang -DCMAKE_CXX_COMPILER:FILEPATH=/usr/bin/clang++ --no-warn-unused-cli -S /<masked_user_home>/Sources/cmake-examples/01-basic/A-hello-cmake -B /<masked_user_home>/Sources/cmake-examples/01-basic/A-hello-cmake/build -G Ninja exited with code: 1
[extension] [8271] cmake.cleanConfigure finished (returned 1)

Additional Information

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    buga bug in the product

    Type

    No type

    Projects

    Status

    Blocked

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions