[clang] c720c1d - Revert "[clang][cmake] Add options to pass in vcs repo and revision info"
Han Zhu via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 17 10:09:39 PDT 2023
Author: Han Zhu
Date: 2023-04-17T10:09:27-07:00
New Revision: c720c1db11732e6e5ab60a6db41e155d4ab6f708
URL: https://github.com/llvm/llvm-project/commit/c720c1db11732e6e5ab60a6db41e155d4ab6f708
DIFF: https://github.com/llvm/llvm-project/commit/c720c1db11732e6e5ab60a6db41e155d4ab6f708.diff
LOG: Revert "[clang][cmake] Add options to pass in vcs repo and revision info"
This reverts commit 1f5e737fc135bf991889a1364b8f8c5edc3953d2.
Added:
Modified:
clang/lib/Basic/CMakeLists.txt
llvm/cmake/modules/GenerateVersionFromVCS.cmake
Removed:
################################################################################
diff --git a/clang/lib/Basic/CMakeLists.txt b/clang/lib/Basic/CMakeLists.txt
index c05036a216c74..8c828e4c73225 100644
--- a/clang/lib/Basic/CMakeLists.txt
+++ b/clang/lib/Basic/CMakeLists.txt
@@ -14,19 +14,9 @@ set(generate_vcs_version_script "${LLVM_CMAKE_DIR}/GenerateVersionFromVCS.cmake"
if(llvm_vc AND LLVM_APPEND_VC_REV)
set(llvm_source_dir ${LLVM_MAIN_SRC_DIR})
endif()
-if (LLVM_VC_REPOSITORY AND LLVM_VC_REVISION)
- set(llvm_source_dir ${LLVM_SOURCE_DIR})
- set(llvm_vc_repository ${LLVM_VC_REPOSITORY})
- set(llvm_vc_revision ${LLVM_VC_REVISION})
-endif()
if(clang_vc AND LLVM_APPEND_VC_REV)
set(clang_source_dir ${CLANG_SOURCE_DIR})
endif()
-if (CLANG_VC_REPOSITORY AND CLANG_VC_REVISION)
- set(clang_source_dir ${CLANG_SOURCE_DIR})
- set(clang_vc_repository ${CLANG_VC_REPOSITORY})
- set(clang_vc_revision ${CLANG_VC_REVISION})
-endif()
# Create custom target to generate the VC revision include.
add_custom_command(OUTPUT "${version_inc}"
@@ -34,11 +24,7 @@ add_custom_command(OUTPUT "${version_inc}"
COMMAND ${CMAKE_COMMAND} "-DNAMES=\"LLVM;CLANG\""
"-DLLVM_SOURCE_DIR=${llvm_source_dir}"
"-DCLANG_SOURCE_DIR=${clang_source_dir}"
- "-DCLANG_VC_REPOSITORY=${clang_vc_repository}"
- "-DCLANG_VC_REVISION=${clang_vc_revision}"
"-DHEADER_FILE=${version_inc}"
- "-DLLVM_VC_REPOSITORY=${llvm_vc_repository}"
- "-DLLVM_VC_REVISION=${llvm_vc_revision}"
-P "${generate_vcs_version_script}")
# Mark the generated header as being generated.
diff --git a/llvm/cmake/modules/GenerateVersionFromVCS.cmake b/llvm/cmake/modules/GenerateVersionFromVCS.cmake
index d5bdf43df7230..d8ec54df41ebd 100644
--- a/llvm/cmake/modules/GenerateVersionFromVCS.cmake
+++ b/llvm/cmake/modules/GenerateVersionFromVCS.cmake
@@ -18,7 +18,10 @@ include(VersionFromVCS)
# Handle strange terminals
set(ENV{TERM} "dumb")
-function(append_info name revision repository)
+function(append_info name path)
+ if(path)
+ get_source_info("${path}" revision repository)
+ endif()
if(revision)
file(APPEND "${HEADER_FILE}.tmp"
"#define ${name}_REVISION \"${revision}\"\n")
@@ -36,15 +39,10 @@ function(append_info name revision repository)
endfunction()
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()
+ if(NOT DEFINED ${name}_SOURCE_DIR)
message(FATAL_ERROR "${name}_SOURCE_DIR is not defined")
endif()
- append_info(${name} ${revision} ${repository})
+ append_info(${name} "${${name}_SOURCE_DIR}")
endforeach()
# Copy the file only if it has changed.
More information about the cfe-commits
mailing list