This is an archive of the discontinued LLVM Phabricator instance.

cmake: fix .git-dir detection with using git-rev-parse (regression since 4.0)
AcceptedPublic

Authored by pboettch on Sep 19 2017, 4:42 AM.

Details

Reviewers
hans
modocache
Summary

When using clang as a link in llvm/tools in conjunction with using git repositories running ninja fails with

ninja: error: '/home/.../llvm/.git/modules/external/clang/logs/HEAD', needed by 'tools/clang/lib/Basic/SVNVersion.inc', missing and no known rule to make it

If a .git-file or path is found, we need to determine the real .git-path, which could be anywhere when this repo is a submodule, or ln'd
into tools/.

This patch fixes it by using git rev-parse as llvm/include/llvm/Support/CMakeLists.txt is doing it.

Introduced with https://reviews.llvm.org/D34955

Diff Detail

Event Timeline

pboettch created this revision.Sep 19 2017, 4:42 AM
modocache accepted this revision.Sep 19 2017, 11:14 AM

Thanks for the improvement!

lib/Basic/CMakeLists.txt
24

Reading llvm/include/llvm/Support/CMakeLists.txt, I didn't see very much that was borrowed here. I did see similar code in llvm/cmake/modules/VersionFromVCS.cmake, though. Is this a typo? Or maybe I'm misreading?

This revision is now accepted and ready to land.Sep 19 2017, 11:14 AM