1
0
Fork 0
forked from suyu/suyu

Merge pull request #9844 from abouvier/jwt-fix

cmake: fix cpp-jwt build
This commit is contained in:
liamwhite 2023-02-27 19:46:19 -05:00 committed by GitHub
commit a78a475815
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 10 deletions

View file

@ -244,6 +244,9 @@ endif()
if (ENABLE_WEB_SERVICE) if (ENABLE_WEB_SERVICE)
find_package(cpp-jwt 1.4 CONFIG) find_package(cpp-jwt 1.4 CONFIG)
find_package(httplib 0.12 MODULE) find_package(httplib 0.12 MODULE)
if (NOT cpp-jwt_FOUND OR NOT httplib_FOUND)
find_package(OpenSSL 1.1 MODULE COMPONENTS Crypto SSL)
endif()
endif() endif()
if (YUZU_TESTS) if (YUZU_TESTS)

View file

@ -100,17 +100,9 @@ endif()
# Sirit # Sirit
add_subdirectory(sirit EXCLUDE_FROM_ALL) add_subdirectory(sirit EXCLUDE_FROM_ALL)
# httplib # LibreSSL
if (ENABLE_WEB_SERVICE AND NOT TARGET httplib::httplib) if (ENABLE_WEB_SERVICE AND DEFINED OPENSSL_FOUND)
if (NOT WIN32)
find_package(OpenSSL 1.1)
if (OPENSSL_FOUND)
set(OPENSSL_LIBRARIES OpenSSL::SSL OpenSSL::Crypto)
endif()
endif()
if (WIN32 OR NOT OPENSSL_FOUND) if (WIN32 OR NOT OPENSSL_FOUND)
# LibreSSL
set(LIBRESSL_SKIP_INSTALL ON) set(LIBRESSL_SKIP_INSTALL ON)
set(OPENSSLDIR "/etc/ssl/") set(OPENSSLDIR "/etc/ssl/")
add_subdirectory(libressl EXCLUDE_FROM_ALL) add_subdirectory(libressl EXCLUDE_FROM_ALL)
@ -119,8 +111,13 @@ if (ENABLE_WEB_SERVICE AND NOT TARGET httplib::httplib)
get_directory_property(OPENSSL_LIBRARIES get_directory_property(OPENSSL_LIBRARIES
DIRECTORY libressl DIRECTORY libressl
DEFINITION OPENSSL_LIBS) DEFINITION OPENSSL_LIBS)
else()
set(OPENSSL_LIBRARIES OpenSSL::SSL OpenSSL::Crypto)
endif() endif()
endif()
# httplib
if (ENABLE_WEB_SERVICE AND NOT TARGET httplib::httplib)
add_library(httplib INTERFACE) add_library(httplib INTERFACE)
target_include_directories(httplib INTERFACE ./cpp-httplib) target_include_directories(httplib INTERFACE ./cpp-httplib)
target_compile_definitions(httplib INTERFACE -DCPPHTTPLIB_OPENSSL_SUPPORT) target_compile_definitions(httplib INTERFACE -DCPPHTTPLIB_OPENSSL_SUPPORT)
@ -136,6 +133,7 @@ if (ENABLE_WEB_SERVICE AND NOT TARGET cpp-jwt::cpp-jwt)
add_library(cpp-jwt INTERFACE) add_library(cpp-jwt INTERFACE)
target_include_directories(cpp-jwt INTERFACE ./cpp-jwt/include) target_include_directories(cpp-jwt INTERFACE ./cpp-jwt/include)
target_compile_definitions(cpp-jwt INTERFACE CPP_JWT_USE_VENDORED_NLOHMANN_JSON) target_compile_definitions(cpp-jwt INTERFACE CPP_JWT_USE_VENDORED_NLOHMANN_JSON)
target_link_libraries(cpp-jwt INTERFACE ${OPENSSL_LIBRARIES})
add_library(cpp-jwt::cpp-jwt ALIAS cpp-jwt) add_library(cpp-jwt::cpp-jwt ALIAS cpp-jwt)
endif() endif()