diff --git a/clang/lib/Basic/CMakeLists.txt b/clang/lib/Basic/CMakeLists.txt --- a/clang/lib/Basic/CMakeLists.txt +++ b/clang/lib/Basic/CMakeLists.txt @@ -12,10 +12,10 @@ set(generate_vcs_version_script "${LLVM_CMAKE_PATH}/GenerateVersionFromVCS.cmake") -if(llvm_vc AND LLVM_APPEND_VC_REV) +if(LLVM_APPEND_VC_REV) set(llvm_source_dir ${LLVM_MAIN_SRC_DIR}) endif() -if(clang_vc AND LLVM_APPEND_VC_REV) +if(LLVM_APPEND_VC_REV) set(clang_source_dir ${CLANG_SOURCE_DIR}) endif() diff --git a/lld/Common/CMakeLists.txt b/lld/Common/CMakeLists.txt --- a/lld/Common/CMakeLists.txt +++ b/lld/Common/CMakeLists.txt @@ -2,13 +2,12 @@ set(tablegen_deps intrinsics_gen) endif() -find_first_existing_vc_file("${LLVM_MAIN_SRC_DIR}" llvm_vc) 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 AND LLVM_APPEND_VC_REV) +if(LLVM_APPEND_VC_REV) set(lld_source_dir ${LLD_SOURCE_DIR}) endif() diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake --- a/llvm/cmake/modules/AddLLVM.cmake +++ b/llvm/cmake/modules/AddLLVM.cmake @@ -2110,7 +2110,7 @@ get_filename_component(git_dir ${git_output} ABSOLUTE BASE_DIR ${path}) # Some branchless cases (e.g. 'repo') may not yet have .git/logs/HEAD if (NOT EXISTS "${git_dir}/logs/HEAD") - file(WRITE "${git_dir}/logs/HEAD" "") + return() endif() set(${out_var} "${git_dir}/logs/HEAD" PARENT_SCOPE) endif() diff --git a/llvm/include/llvm/Support/CMakeLists.txt b/llvm/include/llvm/Support/CMakeLists.txt --- a/llvm/include/llvm/Support/CMakeLists.txt +++ b/llvm/include/llvm/Support/CMakeLists.txt @@ -5,7 +5,7 @@ set(generate_vcs_version_script "${LLVM_CMAKE_PATH}/GenerateVersionFromVCS.cmake") -if(llvm_vc AND LLVM_APPEND_VC_REV) +if(LLVM_APPEND_VC_REV) set(llvm_source_dir ${LLVM_MAIN_SRC_DIR}) endif()