Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
json
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
json
Commits
f4c4bab6
Unverified
Commit
f4c4bab6
authored
Jun 16, 2020
by
Niels Lohmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
✨
add option JSON_TestDataDirectory to set path with test data #2189
parent
e7452d87
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
9 deletions
+15
-9
cmake/download_test_data.cmake
cmake/download_test_data.cmake
+15
-9
No files found.
cmake/download_test_data.cmake
View file @
f4c4bab6
...
@@ -3,15 +3,21 @@ find_package(Git)
...
@@ -3,15 +3,21 @@ 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
)
# target to download test data
# if variable is set, use test data from given directory rather than downloading them
add_custom_target
(
download_test_data
if
(
JSON_TestDataDirectory
)
message
(
STATUS
"Using test data in
${
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
()
# 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
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
COMMENT
"Downloading test data from
${
JSON_TEST_DATA_URL
}
(v
${
JSON_TEST_DATA_VERSION
}
)"
COMMENT
"Downloading test data from
${
JSON_TEST_DATA_URL
}
(v
${
JSON_TEST_DATA_VERSION
}
)"
WORKING_DIRECTORY
${
CMAKE_BINARY_DIR
}
WORKING_DIRECTORY
${
CMAKE_BINARY_DIR
}
)
)
# create a header with the path to the downloaded test data
# create a header with the path to the downloaded test data
file
(
WRITE
${
CMAKE_BINARY_DIR
}
/include/test_data.hpp
"#define TEST_DATA_DIRECTORY
\"
${
CMAKE_BINARY_DIR
}
/json_test_data
\"\n
"
)
file
(
WRITE
${
CMAKE_BINARY_DIR
}
/include/test_data.hpp
"#define TEST_DATA_DIRECTORY
\"
${
CMAKE_BINARY_DIR
}
/json_test_data
\"\n
"
)
endif
(
)
# determine the operating system (for debug and support purposes)
# determine the operating system (for debug and support purposes)
find_program
(
UNAME_COMMAND uname
)
find_program
(
UNAME_COMMAND uname
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment