| author | |
| committer | |
| log | 25bbb1a8ff7074a56b4da98de24a549e223d0009 |
| tree | 4e7f7190753ab9b8f4d15d9d5242fd626600446f |
| parent | a3ab4325fd05807c4a5b70aed3b515ce7ccd753f |
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.1 files changed, 1 insertions(+), 1 deletions(-)
CMakeLists.txt+1-1| ... | ... | @@ -22,7 +22,7 @@ set(ZIG_VERSION "${ZIG_VERSION_MAJOR}.${ZIG_VERSION_MINOR}.${ZIG_VERSION_PATCH}" |
| 22 | 22 | find_program(GIT_EXE NAMES git) |
| 23 | 23 | if(GIT_EXE) |
| 24 | 24 | execute_process( |
| 25 | COMMAND ${GIT_EXE} name-rev HEAD --tags --name-only --no-undefined --always | |
| 25 | COMMAND ${GIT_EXE} -C ${CMAKE_SOURCE_DIR} name-rev HEAD --tags --name-only --no-undefined --always | |
| 26 | 26 | OUTPUT_VARIABLE ZIG_GIT_REV |
| 27 | 27 | OUTPUT_STRIP_TRAILING_WHITESPACE) |
| 28 | 28 | if(ZIG_GIT_REV MATCHES "\\^0$") |