[PATCH] D148262: [clang][cmake] Add options to pass in vcs repo and revision info

Han Zhu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 14 14:52:45 PDT 2023


zhuhan0 added inline comments.


================
Comment at: llvm/cmake/modules/GenerateVersionFromVCS.cmake:50
+    endif()
+    append_info(${name} "${${name}_SOURCE_DIR}" "" "")
   endif()
----------------
drodriguez wrote:
> I would recommend changing the flow a little bit:
> 
> - Remove `path` argument from `append_info`. Leave `name`, `revision`, and `repository`.
> - Remove the `if(path) get_source_info() endif()` part.
> - Change this `foreach` to the following:
> 
> ```
> foreach(name IN LISTS NAMES)
>   if(${name}_VC_REPOSITORY AND ${name}_VC_REVISION)
>    set(revision ${${name}_VC_REVISION})
>    set(repository ${${name}_VC_REPOSITORY})
>   elseif(DEFINED ${name}_SOURCE_DIR)
>     get_source_info(${${name}_SOURCE_DIR} revision repository)
>   else()
>     message(FATAL_ERROR "${name}_SOURCE_DIR is not defined")
>   endif()
>   append_info(${name} ${revision} ${repository})
> endforeach()
> ```
Looks much better!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D148262/new/

https://reviews.llvm.org/D148262



More information about the llvm-commits mailing list