1
1
cmake_minimum_required (VERSION 3.8 )
2
2
3
+ # HUNTER_ENABLED is always set if this package is included in a project using hunter (HunterGate sets it)
4
+ # In this case we will use hunter as well to stay consistent. If not the use can supply it on configure
5
+ # to force using hunter.
6
+ if (HUNTER_ENABLED )
7
+ include ("cmake/HunterGate.cmake" )
8
+ HunterGate (
9
+ URL "https://github.com/cpp-pm/hunter/archive/v0.23.314.tar.gz"
10
+ SHA1 "95c47c92f68edb091b5d6d18924baabe02a6962a"
11
+ )
12
+ message (STATUS "jwt-cpp: using hunter for dependency resolution" )
13
+ endif ()
14
+
3
15
project (jwt-cpp )
4
16
5
17
option (JWT_BUILD_EXAMPLES "Configure CMake to build examples (or not)" ON )
@@ -20,12 +32,23 @@ if(NOT JWT_SSL_LIBRARY IN_LIST JWT_SSL_LIBRARY_OPTIONS)
20
32
message (FATAL_ERROR "JWT_SSL_LIBRARY must be one of ${JWT_SSL_LIBRARY_OPTIONS} " )
21
33
endif ()
22
34
23
- if (${JWT_SSL_LIBRARY} MATCHES "OpenSSL" )
24
- find_package (OpenSSL 1.0.2 REQUIRED )
35
+ # If Hunter is enabled, we configure it to resolve OpenSSL and warn
36
+ # the user if he selected an option not supported by hunter.
37
+ # We fall back to the system library in this case.
38
+ if (HUNTER_ENABLED )
39
+ if (${JWT_SSL_LIBRARY} MATCHES "OpenSSL" )
40
+ hunter_add_package (OpenSSL )
41
+ elseif (${JWT_SSL_LIBRARY} MATCHES "LibreSSL" )
42
+ message (WARNING "Hunter does not support LibreSSL yet, the system library will be used (if available)" )
43
+ endif ()
44
+ if (JWT_EXTERNAL_PICOJSON )
45
+ message (WARNING "Hunter does not support picojson yet, the system library will be used (if available)" )
46
+ endif ()
25
47
endif ()
26
-
27
- if (${JWT_SSL_LIBRARY} MATCHES "LibreSSL" )
28
- find_package (LibreSSL 3.0.0 REQUIRED )
48
+ if (${JWT_SSL_LIBRARY} MATCHES "OpenSSL" )
49
+ find_package (OpenSSL 1.0.2 REQUIRED )
50
+ elseif (${JWT_SSL_LIBRARY} MATCHES "LibreSSL" )
51
+ find_package (LibreSSL 3.0.0 REQUIRED )
29
52
endif ()
30
53
31
54
if (JWT_EXTERNAL_PICOJSON )
0 commit comments