Skip to content

Normalize Visual Studio kit target arch for ${buildKitTargetArch}#4680

Draft
Copilot wants to merge 3 commits intomainfrom
copilot/fix-buildkit-target-arch-issue
Draft

Normalize Visual Studio kit target arch for ${buildKitTargetArch}#4680
Copilot wants to merge 3 commits intomainfrom
copilot/fix-buildkit-target-arch-issue

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 30, 2026

This changes visible behavior

The following changes are proposed:

  • Normalize Visual Studio kit architectures (x86/x64/arm/arm64/amd64/win32) to canonical target triples so ${buildKitTargetArch} expands correctly.
  • Keep triple parsing support for arm64 and related VS kit cases.
  • Minor lint fix (const for targetArch) to keep the mapping clean.

The purpose of this change

Ensure build directory and other substitutions use the selected VS kit architecture (e.g., build/x64 instead of build/unknown).

Other Notes/Information

Example:

// Before: VS 2022 x64 kit -> build/unknown
const triple = `${normalizedArch}-pc-windows-msvc`; // normalizedArch = 'x86_64'

// After: VS 2022 x64 kit -> build/x64

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • update.code.visualstudio.com
    • Triggering command: /opt/hostedtoolcache/node/24.13.0/x64/bin/node /opt/hostedtoolcache/node/24.13.0/x64/bin/node ./out/test/unit-tests/runTest.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>[Bug] ${buildKitTargetArch} is 'unknown' for Visual Studio Kits</issue_title>
<issue_description>### Brief Issue Summary

When using ${buildKitTargetArch} as Variable substitution in Build Directory (${workspaceFolder}/build/${buildKitTargetArch}) for Visual Studio Kits (tested in Visual Studio Professional 2019 and 2022 Release) the created folder is 'build/unknown' for all target architectures:

Image

CMake Tools Diagnostics

{
  "os": "win32",
  "vscodeVersion": "1.103.1",
  "cmtVersion": "1.22.7",
  "configurations": [
    {
      "folder": "e:\\DeltaIdPlus\\OCR\\cpp",
      "cmakeVersion": "4.1.1",
      "configured": false,
      "generator": "Visual Studio 17 2022",
      "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: cmaketest 
[main] Saving open files before configure/build
[expand] expanded ${workspaceFolder}/build/${buildKitTargetArch}
[driver] Start configure 
[driver] Running pre-configure checks and steps
[expand] expanded ${workspaceFolder}/build/${buildKitTargetArch}
[cmakefileapi-driver] Configuring using kit
[cmakefileapi-driver] Invoking CMake C:\Program Files\CMake\bin\cmake.exe with arguments ["-DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE","--no-warn-unused-cli","-S","E:/cmaketest","-B","e:/cmaketest/build/unknown","-G","Visual Studio 17 2022","-T","host=x64","-A","x64"]
[proc] Executing command: "C:\Program Files\CMake\bin\cmake.exe" -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE --no-warn-unused-cli -S E:/cmaketest -B e:/cmaketest/build/unknown -G "Visual Studio 17 2022" -T host=x64 -A x64
[proc]   with environment: {"windir":"C:\\WINDOWS"}
[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] Not searching for unused variables given on the command line.
[cmake] -- Configuring done (0.0s)
[cmake] -- Generating done (0.0s)
[cmake] -- Build files have been written to: E:/cmaketest/build/unknown
[cmakefileapi-parser] Read reply folder: e:\cmaketest\build\unknown\.cmake\api\v1\reply
[cmakefileapi-parser] Found index files: ["cache-v2-601efeae2835cb0cd94f.json","cmakeFiles-v1-7c2c6f222de125540abf.json","codemodel-v2-abef0fa53ac10be45b2d.json","directory-.-Debug-d0094a50bb2071803777.json","directory-.-MinSizeRel-d0094a50bb2071803777.json","directory-.-Release-d0094a50bb2071803777.json","directory-.-RelWithDebInfo-d0094a50bb2071803777.json","index-2025-08-29T08-35-50-0185.json","target-ALL_BUILD-Debug-21b93cdebeda8b7eaff2.json","target-ALL_BUILD-MinSizeRel-21b93cdebeda8b7eaff2.json","target-ALL_BUILD-Release-21b93cdebeda8b7eaff2.json","target-ALL_BUILD-RelWithDebInfo-21b93cdebeda8b7eaff2.json","target-ZERO_CHECK-Debug-a51371a7c25be58acdcf.json","target-ZERO_CHECK-MinSizeRel-a51371a7c25be58acdcf.json","target-ZERO_CHECK-Release-a51371a7c25be58acdcf.json","target-ZERO_CHECK-RelWithDebInfo-a51371a7c25be58acdcf.json","toolchains-v1-07df8119f147e128ca2e.json"]
[kit] VS installation instance not found for kit "Visual Studio Professional 2022 Release - amd64" - (7649b17b). It is recommended you re-scan the kits and also remove any user-local entries that are not present anymore on the system.
[cache] Reading CMake cache file e:/cmaketest/build/unknown/CMakeCache.txt
[cache] Parsing CMake cache string

Additional Information

No response</issue_description>

<agent_instructions>You are Copilot coding agent acting as a senior maintainer/contributor for the VS Code extension repository microsoft/vscode-cmake-tools.
You are deeply familiar with CMake, CMake Presets, CTest, ki...


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Fix unknown ${buildKitTargetArch} in Visual Studio Kits Fix ${buildKitTargetArch} resolution for Visual Studio kits Jan 30, 2026
Copilot AI requested a review from hanniavalera January 30, 2026 14:28
Co-authored-by: hanniavalera <90047725+hanniavalera@users.noreply.github.com>
@hanniavalera hanniavalera force-pushed the copilot/fix-buildkit-target-arch-issue branch from c4a35ad to 79d921e Compare February 3, 2026 16:10
Co-authored-by: hanniavalera <90047725+hanniavalera@users.noreply.github.com>
Copilot AI changed the title Fix ${buildKitTargetArch} resolution for Visual Studio kits Normalize Visual Studio kit target arch for ${buildKitTargetArch} Feb 12, 2026
@lygstate
Copy link
Copy Markdown
Contributor

@copilot arm64 is just a alias of aarch64

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] ${buildKitTargetArch} is 'unknown' for Visual Studio Kits

3 participants