-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
feat: add option to use system-installed jwt-cpp #4596
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -247,6 +247,10 @@ 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_TARGET_DISTRO MATCHES "^el") OR (ZM_TARGET_DISTRO MATCHES "^fc")) | ||
| set(ZM_RUNDIR "/run/zoneminder") | ||
| set(ZM_SOCKDIR "/var/lib/zoneminder/sock") | ||
|
|
@@ -397,6 +401,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() | ||
|
Comment on lines
+404
to
+420
|
||
|
|
||
| # GnuTLS | ||
| if (${ZM_CRYPTO_BACKEND} STREQUAL "gnutls") | ||
| find_library(GNUTLS_LIBRARIES gnutls REQUIRED) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ZM_USE_SYSTEM_JWT_CPP option is only meaningful when ZM_JWT_BACKEND is set to "jwt_cpp". If a user sets ZM_USE_SYSTEM_JWT_CPP to ON but uses the libjwt backend, the option is silently ignored, which could be confusing.
Consider adding a warning message after line 252 to inform users about this:
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()
This helps users understand the relationship between these options.