Small release asset for CMake's FetchContent #3255
nlohmann
started this conversation in
Show and tell
Replies: 2 comments 7 replies
-
You have my +1 for creating such a stable release tarball! I'm currently packaging 'nlohmann-json' for ptxdist and had a look at the experimental tar.xz files. I noticed two things:
Let it look like this:
So, some issues in detail, but in general 👍🏼 for working on this. 😃 |
Beta Was this translation helpful? Give feedback.
7 replies
-
I just merged #3289. I will update documentation and the releases next. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Problem
Using the repository as source for a CMake
FetchContent
orExternalProject
can be a bit disappointing, because a complete checkout is quite large and takes time: cloning tagv3.10.5
requires downloading 285.41 MB. Alternatively, a different Git URL such as https://github.com/ArthurSonzogni/nlohmann_json_cmake_fetchcontent.git can be used.Due to https://gitlab.kitware.com/cmake/cmake/-/issues/17770, the situation cannot be improved by using
GIT_SHALLOW TRUE
, because this does not implygit clone --depth 1
, butgit clone --depth 1 --no-single-branch
.Alternative solution
All that is needed to actually use the library with CMake are the following files (
LICENSE.MIT
is not needed technically, but some corporations can get crazy without it):These files are 1.6 MB uncompressed and can get as small as 100 KB as xzipped tarball.
If we would create such a tarball and add it to the GitHub release assets, we could use the following as CMake integration:
# URL is not working as the file has not been uploaded FetchContent_Declare(json URL https://github.com/nlohmann/json/releases/download/v3.10.5/json.tar.xz ) FetchContent_MakeAvailable(json)
Discussion
Upsides:
FetchContent
approach.Downsides:
.git
URL taken directly from GitHub.JSON_BuildTests=ON
does not work.What do you think?
Beta Was this translation helpful? Give feedback.
All reactions