From 0522561ffd9153666f4a7cd7b22fd8b98b80d34e Mon Sep 17 00:00:00 2001 From: Kai Pastor Date: Mon, 23 Sep 2024 20:27:46 +0200 Subject: [PATCH] [jwt-cpp] Fix deps, install config (#41079) Co-authored-by: Billy Robert O'Neal III --- ports/jwt-cpp/external-json.diff | 33 ++++++++++++++++++++++++++++++++ ports/jwt-cpp/portfile.cmake | 18 +++++++++++++---- ports/jwt-cpp/vcpkg.json | 12 +++++++++++- versions/baseline.json | 2 +- versions/j-/jwt-cpp.json | 5 +++++ 5 files changed, 64 insertions(+), 6 deletions(-) create mode 100644 ports/jwt-cpp/external-json.diff diff --git a/ports/jwt-cpp/external-json.diff b/ports/jwt-cpp/external-json.diff new file mode 100644 index 0000000000..b96602c11c --- /dev/null +++ b/ports/jwt-cpp/external-json.diff @@ -0,0 +1,33 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 5cd876f..8e3dfe6 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -66,9 +66,8 @@ if(JWT_EXTERNAL_PICOJSON) + find_package(picojson 1.3.0 REQUIRED) + endif() + +-find_package(nlohmann_json CONFIG) + +-if(NOT nlohmann_json_FOUND) ++if(0) + message(STATUS "jwt-cpp: using FetchContent for nlohmann json") + include(FetchContent) + FetchContent_Declare(nlohmann_json +@@ -121,6 +120,9 @@ endif() + + if(JWT_EXTERNAL_PICOJSON) + target_link_libraries(jwt-cpp INTERFACE picojson::picojson>) ++else() ++ find_path(PICOJSON_INCLUDE_DIR "picojson/picojson.h" REQUIRED) ++ target_include_directories(jwt-cpp INTERFACE "${PICOJSON_INCLUDE_DIR}") + endif() + + # Hunter needs relative paths so the files are placed correctly +@@ -139,7 +141,6 @@ install(EXPORT jwt-cpp-targets NAMESPACE jwt-cpp:: FILE jwt-cpp-targets.cmake + DESTINATION ${JWT_CMAKE_FILES_INSTALL_DIR}) + install(DIRECTORY ${JWT_INCLUDE_PATH}/jwt-cpp DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) + if(NOT JWT_EXTERNAL_PICOJSON AND NOT JWT_DISABLE_PICOJSON) +- install(FILES ${JWT_INCLUDE_PATH}/picojson/picojson.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/picojson) + endif() + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/jwt-cpp-config.cmake ${CMAKE_CURRENT_BINARY_DIR}/jwt-cpp-config-version.cmake + DESTINATION ${JWT_CMAKE_FILES_INSTALL_DIR}) diff --git a/ports/jwt-cpp/portfile.cmake b/ports/jwt-cpp/portfile.cmake index d4371dc4fd..3d6f8a951f 100644 --- a/ports/jwt-cpp/portfile.cmake +++ b/ports/jwt-cpp/portfile.cmake @@ -1,13 +1,23 @@ +set(VCPKG_BUILD_TYPE release) # header-only + vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO Thalhammer/jwt-cpp REF "v${VERSION}" SHA512 b6fdb93e3f2f065a2eb45fe16cb076a932b8d4bfad2251bd66d2be40d8afaf5c27a9cf17aaea61d8bfa3f5ff9ed3b45f90962dc14d72704ac5b9d717c12cc79f HEAD_REF master + PATCHES + external-json.diff +) +file(REMOVE_RECURSE "${SOURCE_PATH}/include/picojson") + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + -DJWT_BUILD_EXAMPLES=OFF + -DJWT_CMAKE_FILES_INSTALL_DIR=share/${PORT} ) -# Copy the header files -file(GLOB HEADER_FILES ${SOURCE_PATH}/include/jwt-cpp/*) -file(COPY ${HEADER_FILES} DESTINATION ${CURRENT_PACKAGES_DIR}/include/jwt-cpp) - +vcpkg_cmake_install() +vcpkg_cmake_config_fixup() vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") diff --git a/ports/jwt-cpp/vcpkg.json b/ports/jwt-cpp/vcpkg.json index b26576646a..77ba82e2b9 100644 --- a/ports/jwt-cpp/vcpkg.json +++ b/ports/jwt-cpp/vcpkg.json @@ -1,10 +1,20 @@ { "name": "jwt-cpp", "version-semver": "0.7.0", + "port-version": 1, "description": "A header only library for creating and validating json web tokens in c++", "homepage": "https://github.com/Thalhammer/jwt-cpp", "license": "MIT", "dependencies": [ - "picojson" + "openssl", + "picojson", + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } ] } diff --git a/versions/baseline.json b/versions/baseline.json index 3f2cb7abef..b861512cc3 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -3886,7 +3886,7 @@ }, "jwt-cpp": { "baseline": "0.7.0", - "port-version": 0 + "port-version": 1 }, "jxrlib": { "baseline": "2019.10.9", diff --git a/versions/j-/jwt-cpp.json b/versions/j-/jwt-cpp.json index 52de0bd741..8a47636b2e 100644 --- a/versions/j-/jwt-cpp.json +++ b/versions/j-/jwt-cpp.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "b0890909dce2e5ce69df737f928c152dd432a6d8", + "version-semver": "0.7.0", + "port-version": 1 + }, { "git-tree": "5302b22e1086039ecf4c3a04a2e8be2218e40305", "version-semver": "0.7.0",