This should make things even more robust. If .git is not found, just disable all git work.

This commit is contained in:
Daniel Lemire 2020-06-24 16:12:19 -04:00
parent f6e9a8eee4
commit 5fc6cb15b8
3 changed files with 11 additions and 3 deletions

View File

@ -16,8 +16,16 @@ include(GNUInstallDirs)
include(cmake/simdjson-flags.cmake)
include(cmake/simdjson-user-cmakecache.cmake)
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git)
set(SIMDJSON_IS_UNDER_GIT ON CACHE BOOL "Whether cmake is under git control")
message( STATUS "The simdjson repository appears to be under git." )
else()
set(SIMDJSON_IS_UNDER_GIT OFF CACHE BOOL "Whether cmake is under git control")
message( STATUS "The simdjson repository does not appear to be under git." )
endif()
if(SIMDJSON_JUST_LIBRARY)
MESSAGE( STATUS "Building just the library, omitting all tests, tools and benchmarks." )
message( STATUS "Building just the library, omitting all tests, tools and benchmarks." )
endif()
#

View File

@ -7,7 +7,7 @@
# Clone the repository if it's not there
find_package(Git QUIET)
if (Git_FOUND AND (GIT_VERSION_STRING VERSION_GREATER "2.1.4")) # We use "-C" which requires a recent git
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
message(STATUS "Git is available and it is recent. We are enabling checkperf targets.")
# sync_git_repository(myrepo ...) creates two targets:
# myrepo - if the repo does not exist, creates and syncs it against the origin branch

View File

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