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
c11f9822
Unverified
Commit
c11f9822
authored
Jan 30, 2022
by
Niels Lohmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
📝
document FetchContent
parent
4d4c2730
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
12 deletions
+19
-12
README.md
README.md
+5
-7
doc/mkdocs/docs/integration/cmake.md
doc/mkdocs/docs/integration/cmake.md
+14
-5
No files found.
README.md
View file @
c11f9822
...
@@ -1185,15 +1185,15 @@ target_link_libraries(foo PRIVATE nlohmann_json::nlohmann_json)
...
@@ -1185,15 +1185,15 @@ target_link_libraries(foo PRIVATE nlohmann_json::nlohmann_json)
Since CMake v3.11,
Since CMake v3.11,
[
FetchContent
](
https://cmake.org/cmake/help/v3.11/module/FetchContent.html
)
can
[
FetchContent
](
https://cmake.org/cmake/help/v3.11/module/FetchContent.html
)
can
be used to automatically download
the repository
as a dependency at configure time.
be used to automatically download
a release
as a dependency at configure time.
Example:
Example:
```
cmake
```
cmake
include
(
FetchContent
)
include
(
FetchContent
)
FetchContent_Declare
(
json
FetchContent_Declare
(
json
GIT_REPOSITORY https://github.com/nlohmann/json.git
URL https://github.com/nlohmann/json/releases/download/v3.10.5/json.tar.xz
GIT_TAG v3.7.3
)
)
FetchContent_GetProperties
(
json
)
FetchContent_GetProperties
(
json
)
if
(
NOT json_POPULATED
)
if
(
NOT json_POPULATED
)
...
@@ -1204,10 +1204,8 @@ endif()
...
@@ -1204,10 +1204,8 @@ endif()
target_link_libraries
(
foo PRIVATE nlohmann_json::nlohmann_json
)
target_link_libraries
(
foo PRIVATE nlohmann_json::nlohmann_json
)
```
```
**Note**
: The repository https://github.com/nlohmann/json download size is huge.
**Note**
: It is recommended to use the URL approach described above which is supported as of version 3.10.0. See
It contains all the dataset used for the benchmarks. You might want to depend on
<https://json.nlohmann.me/integration/cmake/#fetchcontent>
for more information.
a smaller repository. For instance, you might want to replace the URL above by
https://github.com/ArthurSonzogni/nlohmann_json_cmake_fetchcontent
#### Supporting Both
#### Supporting Both
...
...
doc/mkdocs/docs/integration/cmake.md
View file @
c11f9822
...
@@ -90,7 +90,7 @@ to the following.
...
@@ -90,7 +90,7 @@ to the following.
### FetchContent
### FetchContent
Since CMake v3.11,
[
FetchContent
](
https://cmake.org/cmake/help/v3.11/module/FetchContent.html
)
can be used to
Since CMake v3.11,
[
FetchContent
](
https://cmake.org/cmake/help/v3.11/module/FetchContent.html
)
can be used to
automatically download
the repository
as a dependency at configure type.
automatically download
a release
as a dependency at configure type.
!!! example
!!! example
...
@@ -101,8 +101,7 @@ automatically download the repository as a dependency at configure type.
...
@@ -101,8 +101,7 @@ automatically download the repository as a dependency at configure type.
include(FetchContent)
include(FetchContent)
FetchContent_Declare(json
FetchContent_Declare(json
GIT_REPOSITORY https://github.com/nlohmann/json
URL https://github.com/nlohmann/json/releases/download/v3.10.5/json.tar.xz
GIT_TAG v3.10.5
)
)
FetchContent_GetProperties(json)
FetchContent_GetProperties(json)
...
@@ -117,8 +116,18 @@ automatically download the repository as a dependency at configure type.
...
@@ -117,8 +116,18 @@ automatically download the repository as a dependency at configure type.
!!! Note
!!! Note
The repository <https://github.com/nlohmann/json> download size is quite large. You might want to depend on a
It is recommended to use the URL approach described above which is supported as of version 3.10.0. It is also
smaller repository. For instance, you might want to replace the URL in the example by
possible to pass the Git repository like
```cmake
FetchContent_Declare(json
GIT_REPOSITORY https://github.com/nlohmann/json
GIT_TAG v3.10.5
)
```
However, the repository <https://github.com/nlohmann/json> download size is quite large. You might want to depend on
a smaller repository. For instance, you might want to replace the URL in the example by
<https://github.com/ArthurSonzogni/nlohmann_json_cmake_fetchcontent>.
<https://github.com/ArthurSonzogni/nlohmann_json_cmake_fetchcontent>.
## CMake Options
## CMake Options
...
...
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