mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-28 11:21:12 +08:00
[nlohmann-json] Add option to control implicit conversions behaviour (#22409)
* [nlohmann-json] Add "implicit-conversions" triplet variable * [nlohmann-json] Customize usage to document triplet var * [nlohmann-json] Update version files
This commit is contained in:
parent
e3d66251c9
commit
6ad0750a86
@ -6,12 +6,17 @@ vcpkg_from_github(
|
|||||||
HEAD_REF master
|
HEAD_REF master
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if(NOT DEFINED nlohmann-json_IMPLICIT_CONVERSIONS)
|
||||||
|
set(nlohmann-json_IMPLICIT_CONVERSIONS ON)
|
||||||
|
endif()
|
||||||
|
|
||||||
vcpkg_cmake_configure(
|
vcpkg_cmake_configure(
|
||||||
SOURCE_PATH ${SOURCE_PATH}
|
SOURCE_PATH ${SOURCE_PATH}
|
||||||
OPTIONS
|
OPTIONS
|
||||||
-DJSON_Install=ON
|
-DJSON_Install=ON
|
||||||
-DJSON_MultipleHeaders=ON
|
-DJSON_MultipleHeaders=ON
|
||||||
-DJSON_BuildTests=OFF
|
-DJSON_BuildTests=OFF
|
||||||
|
-DJSON_ImplicitConversions=${nlohmann-json_IMPLICIT_CONVERSIONS}
|
||||||
)
|
)
|
||||||
vcpkg_cmake_install()
|
vcpkg_cmake_install()
|
||||||
vcpkg_cmake_config_fixup(PACKAGE_NAME "nlohmann_json" CONFIG_PATH "lib/cmake/nlohmann_json")
|
vcpkg_cmake_config_fixup(PACKAGE_NAME "nlohmann_json" CONFIG_PATH "lib/cmake/nlohmann_json")
|
||||||
@ -35,3 +40,6 @@ file(REMOVE "${CURRENT_PACKAGES_DIR}/debug/nlohmann_json.natvis")
|
|||||||
|
|
||||||
# Handle copyright
|
# Handle copyright
|
||||||
file(INSTALL "${SOURCE_PATH}/LICENSE.MIT" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
|
file(INSTALL "${SOURCE_PATH}/LICENSE.MIT" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
|
||||||
|
|
||||||
|
# Handle usage
|
||||||
|
file(COPY "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
|
||||||
|
12
ports/nlohmann-json/usage
Normal file
12
ports/nlohmann-json/usage
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
The package nlohmann-json provides CMake targets:
|
||||||
|
|
||||||
|
find_package(nlohmann_json CONFIG REQUIRED)
|
||||||
|
target_link_libraries(main PRIVATE nlohmann_json::nlohmann_json)
|
||||||
|
|
||||||
|
The package nlohmann-json can be configured to not provide implicit conversions via a custom triplet file:
|
||||||
|
|
||||||
|
set(nlohmann_json_JSON_ImplicitConversions OFF)
|
||||||
|
|
||||||
|
For more information, see the docs here:
|
||||||
|
|
||||||
|
https://json.nlohmann.me/features/macros/#json_use_implicit_conversions
|
@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "nlohmann-json",
|
"name": "nlohmann-json",
|
||||||
"version-semver": "3.10.5",
|
"version-semver": "3.10.5",
|
||||||
|
"port-version": 1,
|
||||||
"description": "JSON for Modern C++",
|
"description": "JSON for Modern C++",
|
||||||
"homepage": "https://github.com/nlohmann/json",
|
"homepage": "https://github.com/nlohmann/json",
|
||||||
"dependencies": [
|
"dependencies": [
|
||||||
|
@ -4814,7 +4814,7 @@
|
|||||||
},
|
},
|
||||||
"nlohmann-json": {
|
"nlohmann-json": {
|
||||||
"baseline": "3.10.5",
|
"baseline": "3.10.5",
|
||||||
"port-version": 0
|
"port-version": 1
|
||||||
},
|
},
|
||||||
"nlopt": {
|
"nlopt": {
|
||||||
"baseline": "2.7.0",
|
"baseline": "2.7.0",
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
{
|
{
|
||||||
"versions": [
|
"versions": [
|
||||||
|
{
|
||||||
|
"git-tree": "fa0a087d0444a7f2c79a44bce91c51550d5f2e47",
|
||||||
|
"version-semver": "3.10.5",
|
||||||
|
"port-version": 1
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"git-tree": "d1fe747457714c4c43b12502de05b2d006b440d4",
|
"git-tree": "d1fe747457714c4c43b12502de05b2d006b440d4",
|
||||||
"version-semver": "3.10.5",
|
"version-semver": "3.10.5",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user