Skip to content

Commit 5fc6cb1

Browse files
author
Daniel Lemire
committed
This should make things even more robust. If .git is not found, just disable all git work.
1 parent f6e9a8e commit 5fc6cb1

3 files changed

Lines changed: 11 additions & 3 deletions

File tree

CMakeLists.txt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,16 @@ include(GNUInstallDirs)
1616
include(cmake/simdjson-flags.cmake)
1717
include(cmake/simdjson-user-cmakecache.cmake)
1818

19+
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git)
20+
set(SIMDJSON_IS_UNDER_GIT ON CACHE BOOL "Whether cmake is under git control")
21+
message( STATUS "The simdjson repository appears to be under git." )
22+
else()
23+
set(SIMDJSON_IS_UNDER_GIT OFF CACHE BOOL "Whether cmake is under git control")
24+
message( STATUS "The simdjson repository does not appear to be under git." )
25+
endif()
26+
1927
if(SIMDJSON_JUST_LIBRARY)
20-
MESSAGE( STATUS "Building just the library, omitting all tests, tools and benchmarks." )
28+
message( STATUS "Building just the library, omitting all tests, tools and benchmarks." )
2129
endif()
2230

2331
#

benchmark/checkperf.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
# Clone the repository if it's not there
99
find_package(Git QUIET)
10-
if (Git_FOUND AND (GIT_VERSION_STRING VERSION_GREATER "2.1.4")) # We use "-C" which requires a recent git
10+
if (SIMDJSON_IS_UNDER_GIT AND Git_FOUND AND (GIT_VERSION_STRING VERSION_GREATER "2.1.4")) # We use "-C" which requires a recent git
1111
message(STATUS "Git is available and it is recent. We are enabling checkperf targets.")
1212
# sync_git_repository(myrepo ...) creates two targets:
1313
# myrepo - if the repo does not exist, creates and syncs it against the origin branch

dependencies/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33

44
find_package(Git QUIET) # We want the library to build even if git is missing
5-
if (Git_FOUND)
5+
if ((Git_FOUND) AND (SIMDJSON_IS_UNDER_GIT))
66
message(STATUS "Git is available.")
77
# Does NOT attempt to update or otherwise modify git submodules that are already initialized.
88
function(initialize_submodule DIRECTORY)

0 commit comments

Comments
 (0)