From 119c5a995b43886db977ac6a44ec666fb956d148 Mon Sep 17 00:00:00 2001 From: Luca Bruno Date: Mon, 22 Mar 2021 23:10:17 +0000 Subject: [PATCH] cmake/git: tweak submodule detection logic (#5118) This removes an incomplete check in cmake git-submodule detection logic, directly using filepath probing instead. As a direct usecase, it fixes submodule building for https://github.com/prove-rs/z3.rs. --- cmake/git_utils.cmake | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/cmake/git_utils.cmake b/cmake/git_utils.cmake index 82d707194..ea091eb6e 100644 --- a/cmake/git_utils.cmake +++ b/cmake/git_utils.cmake @@ -36,10 +36,7 @@ function(add_git_dir_dependency GIT_DOT_FILE SUCCESS_VAR) if (NOT EXISTS "${GIT_COMMON_DIR_FILE}") get_filename_component(GIT_WORKTREE_PARENT "${GIT_WORKTREE_DIR}" DIRECTORY) get_filename_component(GIT_WORKTREE_PARENT "${GIT_WORKTREE_PARENT}" NAME) - if(NOT EXISTS ${SUBMODULE_DIR_NAME}) - set(SUBMODULE_DIR_NAME modules) - endif() - if ("${GIT_WORKTREE_PARENT}" STREQUAL "${SUBMODULE_DIR_NAME}") + if (EXISTS "${Z3_SOURCE_DIR}/${GIT_HEAD_FILE}" AND EXISTS "${Z3_SOURCE_DIR}/${GIT_WORKTREE_DIR}") # Z3 is a git submodule set(GIT_HEAD_FILE "${Z3_SOURCE_DIR}/${GIT_HEAD_FILE}") set(GIT_DIR "${Z3_SOURCE_DIR}/${GIT_WORKTREE_DIR}")