[jwt-cpp] Fix deps, install config (#41079)

Co-authored-by: Billy Robert O'Neal III <bion@microsoft.com>
This commit is contained in:
Kai Pastor 2024-09-23 20:27:46 +02:00 committed by GitHub
parent 98aa639629
commit 0522561ffd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 64 additions and 6 deletions

View File

@ -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})

View File

@ -1,13 +1,23 @@
set(VCPKG_BUILD_TYPE release) # header-only
vcpkg_from_github( vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH OUT_SOURCE_PATH SOURCE_PATH
REPO Thalhammer/jwt-cpp REPO Thalhammer/jwt-cpp
REF "v${VERSION}" REF "v${VERSION}"
SHA512 b6fdb93e3f2f065a2eb45fe16cb076a932b8d4bfad2251bd66d2be40d8afaf5c27a9cf17aaea61d8bfa3f5ff9ed3b45f90962dc14d72704ac5b9d717c12cc79f SHA512 b6fdb93e3f2f065a2eb45fe16cb076a932b8d4bfad2251bd66d2be40d8afaf5c27a9cf17aaea61d8bfa3f5ff9ed3b45f90962dc14d72704ac5b9d717c12cc79f
HEAD_REF master 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 vcpkg_cmake_install()
file(GLOB HEADER_FILES ${SOURCE_PATH}/include/jwt-cpp/*) vcpkg_cmake_config_fixup()
file(COPY ${HEADER_FILES} DESTINATION ${CURRENT_PACKAGES_DIR}/include/jwt-cpp)
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")

View File

@ -1,10 +1,20 @@
{ {
"name": "jwt-cpp", "name": "jwt-cpp",
"version-semver": "0.7.0", "version-semver": "0.7.0",
"port-version": 1,
"description": "A header only library for creating and validating json web tokens in c++", "description": "A header only library for creating and validating json web tokens in c++",
"homepage": "https://github.com/Thalhammer/jwt-cpp", "homepage": "https://github.com/Thalhammer/jwt-cpp",
"license": "MIT", "license": "MIT",
"dependencies": [ "dependencies": [
"picojson" "openssl",
"picojson",
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
] ]
} }

View File

@ -3886,7 +3886,7 @@
}, },
"jwt-cpp": { "jwt-cpp": {
"baseline": "0.7.0", "baseline": "0.7.0",
"port-version": 0 "port-version": 1
}, },
"jxrlib": { "jxrlib": {
"baseline": "2019.10.9", "baseline": "2019.10.9",

View File

@ -1,5 +1,10 @@
{ {
"versions": [ "versions": [
{
"git-tree": "b0890909dce2e5ce69df737f928c152dd432a6d8",
"version-semver": "0.7.0",
"port-version": 1
},
{ {
"git-tree": "5302b22e1086039ecf4c3a04a2e8be2218e40305", "git-tree": "5302b22e1086039ecf4c3a04a2e8be2218e40305",
"version-semver": "0.7.0", "version-semver": "0.7.0",