[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 16:50:18 +0000 (09:50 -0700)
commit1f5e737fc135bf991889a1364b8f8c5edc3953d2
tree41b50c9419f109a33acc08ecb27e2c24d80c9ac9
parent836786ab7f6c5d94458fe4136807bfea6184e270
[clang][cmake] Add options to pass in vcs repo and revision info

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