Second try: [clang][cmake] Add options to pass in vcs repo and revision info
authorHan Zhu <zhuhan7737@gmail.com>
Mon, 10 Apr 2023 22:40:15 +0000 (15:40 -0700)
committerHan Zhu <zhuhan7737@gmail.com>
Mon, 17 Apr 2023 17:54:28 +0000 (10:54 -0700)
commitee68f612ba682ddb911c5621e63df56039ec5824
treec089507d3a23b64681dfc47b5c9b47b40da77e64
parent932d7b9ddd23bfbe9ac1e8a2dabab8e457993ed4
Second try: [clang][cmake] Add options to pass in vcs repo and revision info

V2: Fix cmake error when -DLLVM_APPEND_VC_REV=OFF

Clang may be built in an environment where Git is not available. In our case,
Clang is part of a larger monorepo which is not Git-based, and
GenerateVersionFromVCS was not able to get source info.

Provide options to pass in repo and revision info from cmake.
```
cmake \
  -DCLANG_VC_REPOSITORY=abc://repo.url.com \
  -DCLANG_VC_REVISION=abcd1234 \
  ...
```
This would allow us to prepare the source info beforehand and pass it to the
clang binary.

Differential Revision: https://reviews.llvm.org/D148262
clang/lib/Basic/CMakeLists.txt
llvm/cmake/modules/GenerateVersionFromVCS.cmake