🔧 overwork CMake files

parent f4c4bab6
find_package(Git)
set(JSON_TEST_DATA_URL https://github.com/nlohmann/json_test_data) set(JSON_TEST_DATA_URL https://github.com/nlohmann/json_test_data)
set(JSON_TEST_DATA_VERSION 2.0.0) set(JSON_TEST_DATA_VERSION 2.0.0)
...@@ -9,6 +7,7 @@ if(JSON_TestDataDirectory) ...@@ -9,6 +7,7 @@ if(JSON_TestDataDirectory)
add_custom_target(download_test_data) add_custom_target(download_test_data)
file(WRITE ${CMAKE_BINARY_DIR}/include/test_data.hpp "#define TEST_DATA_DIRECTORY \"${JSON_TestDataDirectory}\"\n") file(WRITE ${CMAKE_BINARY_DIR}/include/test_data.hpp "#define TEST_DATA_DIRECTORY \"${JSON_TestDataDirectory}\"\n")
else() else()
find_package(Git)
# target to download test data # target to download test data
add_custom_target(download_test_data add_custom_target(download_test_data
COMMAND test -d json_test_data || ${GIT_EXECUTABLE} clone -c advice.detachedHead=false --branch v${JSON_TEST_DATA_VERSION} ${JSON_TEST_DATA_URL}.git --quiet --depth 1 COMMAND test -d json_test_data || ${GIT_EXECUTABLE} clone -c advice.detachedHead=false --branch v${JSON_TEST_DATA_VERSION} ${JSON_TEST_DATA_URL}.git --quiet --depth 1
......
...@@ -4,9 +4,8 @@ project(DummyImport CXX) ...@@ -4,9 +4,8 @@ project(DummyImport CXX)
include(FetchContent) include(FetchContent)
FetchContent_Declare(json get_filename_component(GIT_REPOSITORY_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../../.. ABSOLUTE)
GIT_REPOSITORY ${CMAKE_CURRENT_SOURCE_DIR}/../../.. FetchContent_Declare(json GIT_REPOSITORY ${GIT_REPOSITORY_DIRECTORY} GIT_TAG HEAD)
GIT_TAG HEAD)
FetchContent_GetProperties(json) FetchContent_GetProperties(json)
if(NOT json_POPULATED) if(NOT json_POPULATED)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment