From ce5581d4282f32e383ea3c3db5dc2abb74827d4b Mon Sep 17 00:00:00 2001 From: Daniel Lemire Date: Wed, 24 Jun 2020 17:00:19 -0400 Subject: [PATCH] This makes it so that if we are under someone else, we just build the library. --- cmake/simdjson-flags.cmake | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/cmake/simdjson-flags.cmake b/cmake/simdjson-flags.cmake index 0ea36b1e..b71748a3 100644 --- a/cmake/simdjson-flags.cmake +++ b/cmake/simdjson-flags.cmake @@ -1,4 +1,21 @@ -option(SIMDJSON_JUST_LIBRARY "Build just the library, omit tests, tools and benchmarks" OFF) + +if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) + message (STATUS "The simdjson repository appears to be standalone.") + option(SIMDJSON_JUST_LIBRARY "Build just the library, omit tests, tools and benchmarks" OFF) + message (STATUS "By default, we attempt to build everything.") +else() + message (STATUS "The simdjson repository appears to be used as a subdirectory.") + option(SIMDJSON_JUST_LIBRARY "Build just the library, omit tests, tools and benchmarks" ON) + message (STATUS "By default, we just build the library.") +endif() + +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() # # Flags used by exes and by the simdjson library (project-wide flags)