microsoft / microsoft/vscode-cmake-tools
Install location requires sudo
- Dominant language
- TypeScript
- Stars
- 1.7k
- Forks
- 546
- Avg merge
- 2d 16h
- Merged PRs (30d)
- 32
Description
### Brief Issue Summary
I would like to install my project to `/usr/local` using the `install` CMake target. On my (Mac) system this requires `sudo` permissions. Instead of asking for permissions, CMake Tools simply fails. I can run `sudo ninja install` from the command-line. However, if CMake has to build a binary during this step, it will be written with the owner set to `root`. Then, if I make another target within CMake Tools, e.g. `all`, it will fail because it cannot overwrite the file.
### Expected:
Somehow CMake Tools asks for my password so that I can install to `/usr/local`.
### Other Notes/Information
I admit this may be a difficult problem to solve well. The reason I would like to install to `/usr/local` is that I use BATS as my test framework, and since Apple added System Integrity Protection (SIP) to Mac OS X, child processes no longer receive the `DYLD_LIBRARY_PATH` variable in their environment. This means my BATS tests cannot find my shared libraries, unless they are installed to a system path such as `/usr/local` 😡
If anyone has a better suggestion as a workaround, I am all ears.
Contributor guide
Research direction
Start by tracing how CMake Tools invokes the `install` target and compare it with the reported `sudo ninja install` behavior on macOS. Consider the ownership problem for binaries built during installation and the `/usr/local` permission prompt; done means installation can handle the required permissions without leaving subsequent CMake builds unable to overwrite files.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cmake
- Domain
- build-system
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100