[llvm-branch-commits] [lldb] 0777c90 - Make LLVM_APPEND_VC_REV=OFF affect clang, lld, and lldb as well.
Tom Stellard via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Tue Jun 23 14:48:16 PDT 2020
Author: Nico Weber
Date: 2020-06-23T14:35:35-07:00
New Revision: 0777c907268a8197de102f3770432b0f185de30a
URL: https://github.com/llvm/llvm-project/commit/0777c907268a8197de102f3770432b0f185de30a
DIFF: https://github.com/llvm/llvm-project/commit/0777c907268a8197de102f3770432b0f185de30a.diff
LOG: Make LLVM_APPEND_VC_REV=OFF affect clang, lld, and lldb as well.
When LLVM_APPEND_VC_REV=OFF is set, the current git hash is no
longer embedded into binaries (mostly for --version output).
Without it, most binaries need to relink after every single
commit, even if they didn't change otherwise (due to, say,
a documentation-only commit).
LLVM_APPEND_VC_REV is ON by default, so this doesn't change the
default behavior of anything.
With this, all clients of GenerateVersionFromVCS.cmake honor
LLVM_APPEND_VC_REV.
Differential Revision: https://reviews.llvm.org/D72855
(cherry picked from commit fb5fafb23cc2d8613f8be2487afe94d8594a88ce)
Added:
Modified:
clang/lib/Basic/CMakeLists.txt
lld/Common/CMakeLists.txt
lldb/source/CMakeLists.txt
llvm/cmake/modules/LLVMConfig.cmake.in
llvm/docs/CMake.rst
Removed:
################################################################################
diff --git a/clang/lib/Basic/CMakeLists.txt b/clang/lib/Basic/CMakeLists.txt
index be739c70468e..328e616698cc 100644
--- a/clang/lib/Basic/CMakeLists.txt
+++ b/clang/lib/Basic/CMakeLists.txt
@@ -12,10 +12,10 @@ set(version_inc "${CMAKE_CURRENT_BINARY_DIR}/VCSVersion.inc")
set(generate_vcs_version_script "${LLVM_CMAKE_PATH}/GenerateVersionFromVCS.cmake")
-if(llvm_vc)
+if(llvm_vc AND LLVM_APPEND_VC_REV)
set(llvm_source_dir ${LLVM_MAIN_SRC_DIR})
endif()
-if(clang_vc)
+if(clang_vc AND LLVM_APPEND_VC_REV)
set(clang_source_dir ${CLANG_SOURCE_DIR})
endif()
diff --git a/lld/Common/CMakeLists.txt b/lld/Common/CMakeLists.txt
index 1a04a8074bed..7d5ad654925e 100644
--- a/lld/Common/CMakeLists.txt
+++ b/lld/Common/CMakeLists.txt
@@ -8,14 +8,14 @@ find_first_existing_vc_file("${LLD_SOURCE_DIR}" lld_vc)
set(version_inc "${CMAKE_CURRENT_BINARY_DIR}/VCSVersion.inc")
set(generate_vcs_version_script "${LLVM_CMAKE_PATH}/GenerateVersionFromVCS.cmake")
-if(lld_vc)
+if(lld_vc AND LLVM_APPEND_VC_REV)
set(lld_source_dir ${LLD_SOURCE_DIR})
endif()
add_custom_command(OUTPUT "${version_inc}"
DEPENDS "${lld_vc}" "${generate_vcs_version_script}"
COMMAND ${CMAKE_COMMAND} "-DNAMES=LLD"
- "-DLLD_SOURCE_DIR=${LLD_SOURCE_DIR}"
+ "-DLLD_SOURCE_DIR=${lld_source_dir}"
"-DHEADER_FILE=${version_inc}"
-P "${generate_vcs_version_script}")
diff --git a/lldb/source/CMakeLists.txt b/lldb/source/CMakeLists.txt
index d229f74904a8..b196147e68e7 100644
--- a/lldb/source/CMakeLists.txt
+++ b/lldb/source/CMakeLists.txt
@@ -18,14 +18,14 @@ endforeach()
set(version_inc "${CMAKE_CURRENT_BINARY_DIR}/VCSVersion.inc")
set(generate_vcs_version_script "${LLVM_CMAKE_PATH}/GenerateVersionFromVCS.cmake")
-if(lldb_vc)
+if(lldb_vc AND LLVM_APPEND_VC_REV)
set(lldb_source_dir ${LLDB_SOURCE_DIR})
endif()
add_custom_command(OUTPUT "${version_inc}"
DEPENDS "${lldb_vc}" "${generate_vcs_version_script}"
COMMAND ${CMAKE_COMMAND} "-DNAMES=LLDB"
- "-DLLDB_SOURCE_DIR=${LLDB_SOURCE_DIR}"
+ "-DLLDB_SOURCE_DIR=${lldb_source_dir}"
"-DHEADER_FILE=${version_inc}"
-P "${generate_vcs_version_script}")
diff --git a/llvm/cmake/modules/LLVMConfig.cmake.in b/llvm/cmake/modules/LLVMConfig.cmake.in
index 082393212b67..87684ecba0f5 100644
--- a/llvm/cmake/modules/LLVMConfig.cmake.in
+++ b/llvm/cmake/modules/LLVMConfig.cmake.in
@@ -78,6 +78,8 @@ set(LLVM_LIBDIR_SUFFIX @LLVM_LIBDIR_SUFFIX@)
set(LLVM_INCLUDE_DIRS "@LLVM_CONFIG_INCLUDE_DIRS@")
set(LLVM_LIBRARY_DIRS "@LLVM_CONFIG_LIBRARY_DIRS@")
+set(LLVM_APPEND_VC_REV "@LLVM_APPEND_VC_REV@")
+
# These variables are duplicated for install tree but they have
diff erent
# values for build tree. LLVM_INCLUDE_DIRS contains both source
# and generated include directories while the following variables have
diff --git a/llvm/docs/CMake.rst b/llvm/docs/CMake.rst
index 94ed7cc623d2..a86ebb3a37bd 100644
--- a/llvm/docs/CMake.rst
+++ b/llvm/docs/CMake.rst
@@ -272,7 +272,7 @@ LLVM-specific variables
Generate build targets for the LLVM benchmarks. Defaults to ON.
**LLVM_APPEND_VC_REV**:BOOL
- Embed version control revision info (svn revision number or Git revision id).
+ Embed version control revision info (Git revision id).
The version info is provided by the ``LLVM_REVISION`` macro in
``llvm/include/llvm/Support/VCSRevision.h``. Developers using git who don't
need revision info can disable this option to avoid re-linking most binaries
More information about the llvm-branch-commits
mailing list