microsoft / microsoft/vscode-cmake-tools

"CMake: Install" command doesn't elevate child process on Windows

Open
#3,518 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement Feature: install
Dominant language
TypeScript
Stars
1.7k
Forks
546
Avg merge
2d 16h
Merged PRs (30d)
32

Description

### Brief Issue Summary

CMake --install on Windows requires elevation to copy files when prefix points to Program Files folder.

### CMake Tools Diagnostics

_No response_

### Debug Log

_No response_

### Additional Information

Here is example output for LevelDB installation:
[main] Building folder: leveldb install
[build] Starting build
[proc] Executing command: "C:\Program Files\Microsoft Visual Studio\2022\Preview\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" --build s:/leveldb/build --config Release --target install --
[build] [1/1 0% :: 0.000] Install the project...
[build] -- Install configuration: "Release"
[build] -- Installing: C:/Program Files (x86)/leveldb/lib/libleveldb.a
[build] CMake Error at cmake_install.cmake:44 (file):
[build] file INSTALL cannot copy file "S:/leveldb/build/Release/libleveldb.a" to
[build] "C:/Program Files (x86)/leveldb/lib/libleveldb.a": Permission denied.
[build]
[build]
[build] FAILED: CMakeFiles/Release/install.util
[build] cmd.exe /C "cd /D S:\leveldb\build && "C:\Program Files\Microsoft Visual Studio\2022\Preview\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" -DBUILD_TYPE=Release -P cmake_install.cmake"
[build] ninja: build stopped: subcommand failed.
[proc] The command: "C:\Program Files\Microsoft Visual Studio\2022\Preview\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" --build s:/leveldb/build --config Release --target install -- exited with code: 1
[driver] Build completed: 00:00:00.096
[build] Build finished with exit code 1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The reported entry point is the Windows CMake --build command using --target install, which fails when installing into Program Files. Start by tracing how CMake Tools launches and handles this child process on Windows; done means protected-path installs can elevate successfully instead of producing the shown permission-denied error.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, typescript, vscode
Domain
build-system, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.