diff options
| author | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
|---|---|---|
| committer | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
| commit | 54409423f767d8b1cf30cb7d0efca6b4ca138823 (patch) | |
| tree | d915ac7828703ce4b963efdd9728a1777ba18c1e /vcpkg/ports/nlohmann-json/portfile.cmake | |
Diffstat (limited to 'vcpkg/ports/nlohmann-json/portfile.cmake')
| -rw-r--r-- | vcpkg/ports/nlohmann-json/portfile.cmake | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/vcpkg/ports/nlohmann-json/portfile.cmake b/vcpkg/ports/nlohmann-json/portfile.cmake new file mode 100644 index 0000000..f4ef121 --- /dev/null +++ b/vcpkg/ports/nlohmann-json/portfile.cmake @@ -0,0 +1,51 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO nlohmann/json + REF "v${VERSION}" + SHA512 6cc1e86261f8fac21cc17a33da3b6b3c3cd5c116755651642af3c9e99bb3538fd42c1bd50397a77c8fb6821bc62d90e6b91bcdde77a78f58f2416c62fc53b97d + HEAD_REF master + PATCHES + fix-4742_std_optional.patch +) + +if(NOT DEFINED nlohmann-json_IMPLICIT_CONVERSIONS) + set(nlohmann-json_IMPLICIT_CONVERSIONS ON) +endif() + +vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS +FEATURES + "diagnostics" JSON_Diagnostics +) + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS ${FEATURE_OPTIONS} + -DJSON_Install=ON + -DJSON_MultipleHeaders=ON + -DJSON_BuildTests=OFF + -DJSON_ImplicitConversions=${nlohmann-json_IMPLICIT_CONVERSIONS} +) +vcpkg_cmake_install() +vcpkg_cmake_config_fixup(PACKAGE_NAME "nlohmann_json" CONFIG_PATH "share/cmake/nlohmann_json") +vcpkg_fixup_pkgconfig() + +vcpkg_replace_string( + "${CURRENT_PACKAGES_DIR}/share/nlohmann_json/nlohmann_jsonTargets.cmake" + "{_IMPORT_PREFIX}/nlohmann_json.natvis" + "{_IMPORT_PREFIX}/share/nlohmann_json/nlohmann_json.natvis" + IGNORE_UNCHANGED +) +if(EXISTS "${CURRENT_PACKAGES_DIR}/nlohmann_json.natvis") + file(RENAME + "${CURRENT_PACKAGES_DIR}/nlohmann_json.natvis" + "${CURRENT_PACKAGES_DIR}/share/nlohmann_json/nlohmann_json.natvis" + ) +endif() + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug") + +# Handle 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}") |