Skip to content

[Bug] Incorrect escaping of semicolons in cmake.configureSettings #4585

@kaladron

Description

@kaladron

Brief Issue Summary

When performing a CMake configure, cmake-tools incorrectly escapes semicolons. When setting up LLVM:

{
  "cmake.sourceDirectory": "${workspaceFolder}/runtimes",
  "cmake.configureSettings": {
      "LLVM_ENABLE_RUNTIMES" : "libc;compiler-rt",
      "LLVM_LIBC_FULL_BUILD" : true
  }
}

cmake-tools will configure with "-DLLVM_ENABLE_RUNTIMES:STRING=libc\;compiler-rt". However, it is unnecessary to escape the semicolon because the whole parameter is enclosed in quotes. The result is that the semicolon is passed through to CMake erroneously.

From the CMakeCache.txt file:

LLVM_ENABLE_RUNTIMES:STRING=libc\;compiler-rt

CMake Tools Diagnostics

{
  "os": "linux",
  "vscodeVersion": "1.104.3",
  "cmtVersion": "1.21.36",
  "configurations": [
    {
      "folder": "/workspaces/llvm-project",
      "cmakeVersion": "4.1.2",
      "configured": true,
      "generator": "Ninja",
      "usesPresets": false,
      "compilers": {
        "C": "/usr/bin/clang",
        "CXX": "/usr/bin/clang++"
      }
    }
  ],
  "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: llvm-project 
[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 21.1.3 x86_64-pc-linux-gnu for configure
[expand] expanded ${workspaceFolder}/build
[cmakefileapi-driver] Configuring using kit
[cmakefileapi-driver] Invoking CMake /usr/bin/cmake with arguments ["-DCMAKE_BUILD_TYPE:STRING=Debug","-DLLVM_ENABLE_RUNTIMES:STRING=libc\\;compiler-rt","-DLLVM_LIBC_FULL_BUILD:BOOL=TRUE","-DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE","-DCMAKE_C_COMPILER:FILEPATH=/usr/bin/clang","-DCMAKE_CXX_COMPILER:FILEPATH=/usr/bin/clang++","-Wno-dev","--no-warn-unused-cli","-S","/workspaces/llvm-project/runtimes","-B","/workspaces/llvm-project/build","-G","Ninja"]
[proc] Executing command: /usr/bin/cmake -DCMAKE_BUILD_TYPE:STRING=Debug "-DLLVM_ENABLE_RUNTIMES:STRING=libc\;compiler-rt" -DLLVM_LIBC_FULL_BUILD:BOOL=TRUE -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_C_COMPILER:FILEPATH=/usr/bin/clang -DCMAKE_CXX_COMPILER:FILEPATH=/usr/bin/clang++ -Wno-dev --no-warn-unused-cli -S /workspaces/llvm-project/runtimes -B /workspaces/llvm-project/build -G Ninja
[proc]   with environment: {"GITHUB_TOKEN":"","GIT_COMMITTER_NAME":"GitHub","GITHUB_CODESPACE_TOKEN":"","USER":"vscode","FEATURE_SPARK_POST_COMMIT_CREATE_ITERATION":"true","HOSTNAME":"codespaces-1bbd91","SHLVL":"1","GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN":"app.github.dev","HOME":"/home/vscode","OLDPWD":"/","LESS":"-R","CODESPACES":"true","ZSH":"/home/vscode/.oh-my-zsh","LSCOLORS":"Gxfxcxdxbxegedabagacad","PAGER":"less","GITHUB_GRAPHQL_URL":"https://api.github.com/graphql","GITHUB_USER":"kaladron","ContainerVersion":"13","LOGNAME":"vscode","GITHUB_API_URL":"https://api.github.com","RepositoryName":"llvm-project","_":"/usr/bin/cat","CLOUDENV_ENVIRONMENT_ID":"685acd55-6425-4176-bfe4-8f0aefff87b1","PATH":"/vscode/bin/linux-x64/385651c938df8a906869babee516bffd0ddb9829/bin/remote-cli:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/vcpkg:/home/vscode/.local/bin","SHELL_LOGGED_IN":"true","LS_COLORS":"","GITHUB_REPOSITORY":"kaladron/llvm-project","SHELL":"/bin/zsh","CXX":"clang++","VCPKG_ROOT":"/usr/local/vcpkg","GIT_COMMITTER_EMAIL":"[email protected]","INTERNAL_VSCS_TARGET_URL":"https://uksouth.online.visualstudio.com","PWD":"/vscode/bin/linux-x64/385651c938df8a906869babee516bffd0ddb9829","GITHUB_SERVER_URL":"https://github.com","CC":"clang","CODESPACE_NAME":"stunning-waddle-q6qvj4xp5h9j44","VCPKG_DOWNLOADS":"/usr/local/vcpkg-downloads","VSCODE_CWD":"/vscode/bin/linux-x64/385651c938df8a906869babee516bffd0ddb9829","VSCODE_NLS_CONFIG":"{\"userLocale\":\"en\",\"osLocale\":\"en\",\"resolvedLanguage\":\"en\",\"defaultMessagesFile\":\"/vscode/bin/linux-x64/385651c938df8a906869babee516bffd0ddb9829/out/nls.messages.json\",\"locale\":\"en\",\"availableLanguages\":{}}","VSCODE_HANDLES_SIGPIPE":"true","VSCODE_ESM_ENTRYPOINT":"vs/workbench/api/node/extensionHostProcess","VSCODE_HANDLES_UNCAUGHT_ERRORS":"true","BROWSER":"/vscode/bin/linux-x64/385651c938df8a906869babee516bffd0ddb9829/bin/helpers/browser.sh","ELECTRON_RUN_AS_NODE":"1","VSCODE_IPC_HOOK_CLI":"/tmp/vscode-ipc-55df85f6-72e8-43fb-b619-ec116feb96cc.sock","VSCODE_L10N_BUNDLE_LOCATION":""}
[cmake] Not searching for unused variables given on the command line.
[cmake] -- Performing standalone runtimes build.
[cmake] -- Could NOT find LLVM (missing: LLVM_DIR)
[cmake] -- Could NOT find Clang (missing: Clang_DIR)
[cmake] -- LLVM host triple: x86_64-unknown-linux-gnu
[cmake] -- LLVM default target triple: x86_64-unknown-linux-gnu
[cmake] -- check-runtimes does nothing.
[cmake] -- Configuring done (0.8s)
[cmake] -- Generating done (0.0s)
[cmake] -- Build files have been written to: /workspaces/llvm-project/build
[cmakefileapi-parser] Read reply folder: /workspaces/llvm-project/build/.cmake/api/v1/reply
[cmakefileapi-parser] Found index files: ["cache-v2-0ff43d3e98a0d8157e7e.json","cmakeFiles-v1-28606406d8aa38f024f9.json","codemodel-v2-8ba816393a0b81753bc6.json","directory-.-Debug-f5ebdc15457944623624.json","directory-llvm-lit-Debug-8fe87b22938f8f65fa0f.json","index-2025-10-08T07-08-07-0041.json","target-check-runtimes-Debug-a28468b45d8c5c9e6d1d.json","target-runtimes-test-depends-Debug-9e42429026bba7421282.json","toolchains-v1-783b4b70450f1473ff1d.json"]
[main] Cannot copy compile_commands.json because it does not exist at /workspaces/llvm-project/build/compile_commands.json
[ctest] Folder is not found in Test Explorer: /workspaces/llvm-project/runtimes
[extension] [7867] cmake.configure finished (returned 0)

Additional Information

No response

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