# Fix version detection for out-of-source builds · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/25bbb1a8ff7074a56b4da98de24a549e223d0009)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: 25bbb1a8ff7074a56b4da98de24a549e223d0009

Requested commit: 25bbb1a8ff7074a56b4da98de24a549e223d0009

Commit: 25bbb1a8ff7074a56b4da98de24a549e223d0009

Tree: 4e7f7190753ab9b8f4d15d9d5242fd626600446f

Author: Jay Weisskopf

Committer: Jay Weisskopf

## Message

````
Fix version detection for out-of-source builds

Git was called in the build directory and not the source directory.
This works fine when the build directory resides within the source
repository, but doesn't work for out-of-source builds. Example:

```
~/zigbuild$ cmake ../zig
fatal: not a git repository (or any of the parent directories): .git
Configuring zig version 0.2.0+
```

Use Git's `-C <path>` flag to always point to the source directory so
that it doesn't matter where the build directory lives.

````

## Parents

- [a3ab4325fd05807c4a5b70aed3b515ce7ccd753f](https://git.cafe/gitcafe/zig/commit/a3ab4325fd05807c4a5b70aed3b515ce7ccd753f?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/25bbb1a8ff7074a56b4da98de24a549e223d0009?format=markdown)
