Create dependencies/CMakeLists.txt

This commit is contained in:
John Keiser 2020-04-06 16:04:37 -07:00
parent 3b1b1bfd48
commit 0714f5fc67
2 changed files with 23 additions and 13 deletions

View File

@ -65,23 +65,11 @@ add_definitions(-DSIMDJSON_BENCHMARK_DATA_DIR="${CMAKE_CURRENT_SOURCE_DIR}/jsone
enable_testing() enable_testing()
add_subdirectory(dependencies)
add_subdirectory(tools) add_subdirectory(tools)
add_subdirectory(tests) add_subdirectory(tests)
add_subdirectory(benchmark) add_subdirectory(benchmark)
if (SIMDJSON_GOOGLE_BENCHMARKS)
if(NOT EXISTS dependencies/benchmark/CMakeLists.txt)
# message(STATUS "Unable to find dependencies/benchmark/CMakeLists.txt")
execute_process(COMMAND git submodule update --init -- dependencies/benchmark
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
endif()
option(BENCHMARK_ENABLE_TESTING OFF)
set(BENCHMARK_ENABLE_TESTING OFF)
option(BENCHMARK_ENABLE_INSTALL OFF)
set(BENCHMARK_ENABLE_INSTALL OFF)
add_subdirectory(dependencies/benchmark)
endif()
# for fuzzing, read the comments in the fuzz/CMakeLists.txt file # for fuzzing, read the comments in the fuzz/CMakeLists.txt file
option(ENABLE_FUZZING "enable building the fuzzers" ON) option(ENABLE_FUZZING "enable building the fuzzers" ON)
if(ENABLE_FUZZING) if(ENABLE_FUZZING)

22
dependencies/CMakeLists.txt vendored Normal file
View File

@ -0,0 +1,22 @@
# Init submodules so they can be used
find_package(Git QUIET)
if(GIT_FOUND)
option(SIMDJSON_GIT_SUBMODULE "Check submodules during build" ON)
if(SIMDJSON_GIT_SUBMODULE)
message(STATUS "Updating submodules")
execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
RESULT_VARIABLE GIT_EXIT_CODE)
if(NOT GIT_EXIT_CODE EQUAL "0")
message(FATAL_ERROR "git submodule update --init failed with ${GIT_SUBMOD_RESULT}, please checkout submodules")
endif()
endif()
endif()
if (SIMDJSON_GOOGLE_BENCHMARKS)
option(BENCHMARK_ENABLE_TESTING OFF)
set(BENCHMARK_ENABLE_TESTING OFF)
option(BENCHMARK_ENABLE_INSTALL OFF)
set(BENCHMARK_ENABLE_INSTALL OFF)
add_subdirectory(benchmark)
endif()