From 9dcf44b76744d5f3b734a5d381fcba2339baf5b9 Mon Sep 17 00:00:00 2001 From: Saurav Yadav <42768892+3y3p4tch@users.noreply.github.com> Date: Wed, 20 Jan 2021 15:03:33 +0530 Subject: [PATCH] fix git_utils.cmake (#4954) The code should refrain from using global parameters such as CMAKE_SOURCE_DIR/CMAKE_BINARY_DIR, especially here which is handling the case of Z3 being a submodule. Instead, use project specific variables like Z3_SOURCE_DIR so that people can incorporate z3 build as part of their build-system. --- cmake/git_utils.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/git_utils.cmake b/cmake/git_utils.cmake index 2e2645c37..ba14c5c2b 100644 --- a/cmake/git_utils.cmake +++ b/cmake/git_utils.cmake @@ -38,8 +38,8 @@ function(add_git_dir_dependency GIT_DOT_FILE SUCCESS_VAR) get_filename_component(GIT_WORKTREE_PARENT "${GIT_WORKTREE_PARENT}" NAME) if ("${GIT_WORKTREE_PARENT}" STREQUAL "modules") # Z3 is a git submodule - set(GIT_HEAD_FILE "${CMAKE_SOURCE_DIR}/${GIT_HEAD_FILE}") - set(GIT_DIR "${CMAKE_SOURCE_DIR}/${GIT_WORKTREE_DIR}") + set(GIT_HEAD_FILE "${Z3_SOURCE_DIR}/${GIT_HEAD_FILE}") + set(GIT_DIR "${Z3_SOURCE_DIR}/${GIT_WORKTREE_DIR}") else() message(FATAL_ERROR "Found git worktree dir but could not find \"${GIT_COMMON_DIR_FILE}\"") endif()