From 70334d24de535c8493221a98ef11f65ed8655647 Mon Sep 17 00:00:00 2001 From: Derek Weitzel Date: Tue, 26 May 2020 17:38:18 +0000 Subject: [PATCH] Make picojson a submodule --- .gitmodules | 3 +++ CMakeLists.txt | 21 +++++++++++++++++++++ vendor/picojson | 1 + 3 files changed, 25 insertions(+) create mode 100644 .gitmodules create mode 160000 vendor/picojson diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..6b85706 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "vendor/picojson"] + path = vendor/picojson + url = https://github.com/kazuho/picojson.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 19d7e56..f6e5a73 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,6 +11,27 @@ if(NOT XROOTD_PLUGIN_VERSION) set(XROOTD_PLUGIN_VERSION ${XROOTD_PLUGIN_VERSION} CACHE INTERNAL "") endif() +# Check out picojson submodule +find_package(Git QUIET) +if(GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git") +# Update submodules as needed + option(GIT_SUBMODULE "Check submodules during build" ON) + if(GIT_SUBMODULE) + message(STATUS "Submodule update") + execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + RESULT_VARIABLE GIT_SUBMOD_RESULT) + if(NOT GIT_SUBMOD_RESULT EQUAL "0") + message(FATAL_ERROR "git submodule update --init failed with ${GIT_SUBMOD_RESULT}, please checkout submodules") + endif() + endif() +endif() + +if(NOT EXISTS "${PROJECT_SOURCE_DIR}/vendor/picojson/picojson.h") + message(FATAL_ERROR "The submodules were not downloaded! GIT_SUBMODULE was turned off or failed. Please update submodules and try again.") +endif() + + macro(use_cxx11) if (CMAKE_VERSION VERSION_LESS "3.1") if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") diff --git a/vendor/picojson b/vendor/picojson new file mode 160000 index 0000000..5440d44 --- /dev/null +++ b/vendor/picojson @@ -0,0 +1 @@ +Subproject commit 5440d44d02c22b541fdcc6f6896b502481fc8b7f