Skip to content

Commit 5447d46

Browse files
authored
Fix: Only install git hooks if .git is a directory (submodule-safe) (#954)
Signed-off-by: Alan Jowett <[email protected]>
1 parent e005759 commit 5447d46

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ project(prevail)
1111

1212
include(FetchContent)
1313

14-
if (EXISTS "${PROJECT_SOURCE_DIR}/.git" AND NOT CMAKE_CROSSCOMPILING)
14+
if (IS_DIRECTORY "${PROJECT_SOURCE_DIR}/.git" AND NOT CMAKE_CROSSCOMPILING)
1515
file(COPY "${CMAKE_SOURCE_DIR}/scripts/pre-commit" "${CMAKE_SOURCE_DIR}/scripts/commit-msg" DESTINATION "${PROJECT_SOURCE_DIR}/.git/hooks")
1616
option(prevail_ENABLE_TESTS "Build tests" ON)
1717
else ()
18-
option(prevail_ENABLE_TESTS "Build tests" OFF)
18+
option(prevail_ENABLE_TESTS "Build tests" OFF)
1919
endif ()
2020

2121
message("Building tests: ${prevail_ENABLE_TESTS}")

0 commit comments

Comments
 (0)