microsoft / microsoft/vscode-cmake-tools

What is the Working Directory During Configure?

Open
#1,731 4 comments 4 reactions 0 assignees View on GitHub
enhancement Feature: configure
Dominant language
TypeScript
Stars
1.7k
Forks
546
Avg merge
2d 16h
Merged PRs (30d)
32

Description

### Brief Issue Summary

I have a CMake script that sets my project's version using `execute_process` and a call to Git. My build directory is within the repo (`${workspaceFolder}/build$). The script works fine if I run `cmake` on the command-line. When I configure via the CMake Tools, the script fails with:

```
[cmake] fatal: not a git repository (or any of the parent directories): .git
[cmake] CMake Warning at cmake/GitVersion.cmake:6 (message):
[cmake] Git failed (not a repo, or no tags).
```

Suggesting that CMake is not being run from either the Workspace directory or the build directory.

### Expected:

1. CMake Tools runs CMake somewhere within my repo

### Apparent Behavior:

1. CMake Tools runs CMake from a different directory

### Platform and Versions

- **Operating System**: macOS
- **CMake Version**: 3.19.3
- **VSCode Version**: 1.54.3
- **CMake Tools Extension Version**: 1.6.0
- **Compiler/Toolchain**: Apple Clang

### Other Notes/Information

I looked but I couldn't see a setting for the working directory?

Contributor guide

Open the contributing guide

Research direction

Begin by reproducing the configure flow described in the issue, using the cmake/GitVersion.cmake script and its execute_process call to observe the working directory. Trace the CMake Tools configure entry point to determine where CMake starts, then verify the result with the same Git error. Done means the working-directory behavior is corrected or clearly exposed as a setting, with the reported in-repository configuration working.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.