Skip to content

Commit

Permalink
🔧 overwork CMake files
Browse files Browse the repository at this point in the history
  • Loading branch information
nlohmann committed Jun 16, 2020
1 parent f4c4bab commit 4d96f4c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
3 changes: 1 addition & 2 deletions cmake/download_test_data.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
find_package(Git)

set(JSON_TEST_DATA_URL https://github.com/nlohmann/json_test_data)
set(JSON_TEST_DATA_VERSION 2.0.0)

Expand All @@ -9,6 +7,7 @@ if(JSON_TestDataDirectory)
add_custom_target(download_test_data)
file(WRITE ${CMAKE_BINARY_DIR}/include/test_data.hpp "#define TEST_DATA_DIRECTORY \"${JSON_TestDataDirectory}\"\n")
else()
find_package(Git)
# target to 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
Expand Down
5 changes: 2 additions & 3 deletions test/cmake_fetch_content/project/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ project(DummyImport CXX)

include(FetchContent)

FetchContent_Declare(json
GIT_REPOSITORY ${CMAKE_CURRENT_SOURCE_DIR}/../../..
GIT_TAG HEAD)
get_filename_component(GIT_REPOSITORY_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../../.. ABSOLUTE)
FetchContent_Declare(json GIT_REPOSITORY ${GIT_REPOSITORY_DIRECTORY} GIT_TAG HEAD)

FetchContent_GetProperties(json)
if(NOT json_POPULATED)
Expand Down

0 comments on commit 4d96f4c

Please sign in to comment.