Commit Graph

5 Commits

Author SHA1 Message Date
Niels Lohmann
5b0c804630
🐛 properly assign two labels to one test case #2596 2021-01-27 14:22:58 +01:00
Niels Lohmann
1047d09b2a
annotate non-reproducible tests #2324 2020-08-30 13:23:34 +02:00
Niels Lohmann
e86b3fae98
🔧 add label to tests that require a git checkout 2020-06-17 12:35:59 +02:00
Niels Lohmann
4d96f4cf6a
🔧 overwork CMake files 2020-06-16 20:23:01 +02:00
ArthurSonzogni
c331706644 Add CMake fetchcontent documentation and tests
Github issue:
https://github.com/nlohmann/json/issues/2073

nlohmann::json documents 2 way of depending on it using CMake
1) Copy-paste the project/source into your own project.
2) Install nlohman::json and then use find_package.

(1) pollutes your git repository, (2) requires everyone to install the
dependencies themselves.

Since 2018, CMake provide some kind of 'package manager' features using
[FetchContent](https://cmake.org/cmake/help/v3.17/module/FetchContent.html)
It gives the following:
~~~cmake
include(FetchContent)

FetchContent_Declare(json
  GIT_REPOSITORY https://github.com/nlohmann/json
  GIT_TAG v3.7.3)

FetchContent_GetProperties(json)
if(NOT json_POPULATED)
  FetchContent_Populate(json)
  add_subdirectory( ${json_SOURCE_DIR} ${json_BINARY_DIR} EXCLUDE_FROM_ALL)
endif()
~~~

Then declares the dependency in the target using it:
~~~cmake
target_link_library(my_project PRIVATE nlohmann_json::nlohmann_json
~~~

This patch updates the documentation and provides tests.
2020-04-29 18:28:06 +02:00