Merge pull request #4596 from connortechnology/system_jwt

feat: add option to use system-installed jwt-cpp
pull/4683/head
Isaac Connor 2026-03-05 08:33:07 -05:00 committed by GitHub
commit 2fb5b47332
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 29 additions and 1 deletions

View File

@ -261,6 +261,13 @@ if(NOT ZM_JWT_BACKEND IN_LIST ZM_JWT_BACKEND_OPTIONS)
message(FATAL_ERROR "Invalid value for ZM_JWT_BACKEND. Possible options: ${ZM_JWT_BACKEND_OPTIONS}")
endif()
# Option to use system-installed jwt-cpp instead of vendored version
set(ZM_USE_SYSTEM_JWT_CPP "OFF" CACHE BOOL
"Set to ON to use system-installed jwt-cpp instead of the vendored version. default: OFF")
if(ZM_USE_SYSTEM_JWT_CPP AND NOT (ZM_JWT_BACKEND STREQUAL "jwt_cpp"))
message(WARNING "ZM_USE_SYSTEM_JWT_CPP is set but will be ignored because ZM_JWT_BACKEND is not jwt_cpp")
endif()
if((ZM_TARGET_DISTRO MATCHES "^el") OR (ZM_TARGET_DISTRO MATCHES "^fc"))
set(ZM_RUNDIR "/run/zoneminder")
set(ZM_SOCKDIR "/var/lib/zoneminder/sock")
@ -406,6 +413,24 @@ if (${ZM_JWT_BACKEND} STREQUAL "libjwt")
endif()
endif()
# jwt-cpp (system or vendored)
if (${ZM_JWT_BACKEND} STREQUAL "jwt_cpp")
if(ZM_USE_SYSTEM_JWT_CPP)
find_package(jwt-cpp CONFIG REQUIRED)
if(TARGET jwt-cpp::jwt-cpp)
set(HAVE_SYSTEM_JWT_CPP 1)
set(optlibsfound "${optlibsfound} jwt-cpp(system)")
message(STATUS "Using system-installed jwt-cpp")
else()
message(FATAL_ERROR "System jwt-cpp requested but jwt-cpp::jwt-cpp target not found")
endif()
else()
set(HAVE_SYSTEM_JWT_CPP 0)
set(optlibsfound "${optlibsfound} jwt-cpp(vendored)")
message(STATUS "Using vendored jwt-cpp")
endif()
endif()
# GnuTLS
if (${ZM_CRYPTO_BACKEND} STREQUAL "gnutls")
find_library(GNUTLS_LIBRARIES gnutls REQUIRED)

View File

@ -1,4 +1,7 @@
add_subdirectory(jwt-cpp)
# Only build vendored jwt-cpp if not using system-installed version
if(NOT HAVE_SYSTEM_JWT_CPP)
add_subdirectory(jwt-cpp)
endif()
add_subdirectory(libbcrypt)
add_subdirectory(RtspServer)
add_subdirectory(span-lite)