Skip to content

Commit

Permalink
Merge pull request #60 from DrDaveD/update-jwt-module
Browse files Browse the repository at this point in the history
Update jwt-cpp to update its picojson
  • Loading branch information
djw8605 authored Sep 1, 2021
2 parents a5ee629 + ef4da40 commit 58e11ef
Show file tree
Hide file tree
Showing 29 changed files with 6,739 additions and 1 deletion.
1 change: 0 additions & 1 deletion vendor/jwt-cpp
Submodule jwt-cpp deleted from 34bb06
70 changes: 70 additions & 0 deletions vendor/jwt-cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
cmake_minimum_required(VERSION 3.8)

if(CMAKE_TOOLCHAIN_FILE)
include(${CMAKE_TOOLCHAIN_FILE})
endif()

option(BUILD_TESTS "Configure CMake to build tests (or not)" ON)
option(EXTERNAL_PICOJSON "Use find_package() to locate the picojson header" OFF)

project(jwt-cpp)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(OpenSSL 1.0.2 REQUIRED)
if(EXTERNAL_PICOJSON)
find_package(picojson REQUIRED)
endif()

add_library(jwt-cpp INTERFACE)
add_library(jwt-cpp::jwt-cpp ALIAS jwt-cpp)

target_compile_features(jwt-cpp INTERFACE cxx_std_11)

set(JWT_INCLUDE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/include)
target_include_directories(
jwt-cpp INTERFACE $<BUILD_INTERFACE:${JWT_INCLUDE_PATH}>
$<INSTALL_INTERFACE:include>)

target_link_libraries(jwt-cpp INTERFACE OpenSSL::SSL OpenSSL::Crypto)

set(JWT_HEADERS ${JWT_INCLUDE_PATH}/jwt-cpp/base.h
${JWT_INCLUDE_PATH}/jwt-cpp/jwt.h)
if(NOT EXTERNAL_PICOJSON)
set(PICO_HEADER ${JWT_INCLUDE_PATH}/picojson/picojson.h)
endif()

include(CMakePackageConfigHelpers)
set(INCLUDE_INSTALL_DIR include)

configure_package_config_file(
${CMAKE_CURRENT_LIST_DIR}/cmake/jwt-cpp-config.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/jwt-cpp-config.cmake INSTALL_DESTINATION
${CMAKE_INSTALL_PREFIX}/jwt-cpp/cmake PATH_VARS INCLUDE_INSTALL_DIR EXTERNAL_PICOJSON)

write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/jwt-cpp-config-version.cmake
VERSION 0.3.1 # TBA
COMPATIBILITY ExactVersion)

install(FILES ${JWT_HEADERS} DESTINATION include/jwt-cpp)
if(NOT EXTERNAL_PICOJSON)
install(FILES ${PICO_HEADER} DESTINATION include/picojson)
endif()

install(
TARGETS jwt-cpp
EXPORT jwt-cpp
DESTINATION jwt-cpp)
install(
EXPORT jwt-cpp
NAMESPACE jwt-cpp::
DESTINATION jwt-cpp)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/jwt-cpp-config.cmake
${CMAKE_CURRENT_BINARY_DIR}/jwt-cpp-config-version.cmake
DESTINATION ${CMAKE_INSTALL_PREFIX}/jwt-cpp)

if(BUILD_TESTS)
add_subdirectory(tests)
endif()
Loading

0 comments on commit 58e11ef

Please sign in to comment.