2020-07-16 06:55:31 +08:00
|
|
|
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
|
|
|
|
index dd3a313..8c69d3a 100644
|
|
|
|
--- a/examples/CMakeLists.txt
|
|
|
|
+++ b/examples/CMakeLists.txt
|
2023-05-03 02:34:43 +08:00
|
|
|
@@ -19,16 +19,16 @@ if (LIBEV)
|
2020-07-16 06:55:31 +08:00
|
|
|
TARGET_LINK_LIBRARIES(example-libev hiredis ev)
|
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
-FIND_PATH(LIBEVENT event.h)
|
|
|
|
-if (LIBEVENT)
|
2023-05-03 02:34:43 +08:00
|
|
|
+find_package(Libevent CONFIG REQUIRED)
|
|
|
|
+if (1)
|
2020-07-16 06:55:31 +08:00
|
|
|
ADD_EXECUTABLE(example-libevent example-libevent)
|
|
|
|
- TARGET_LINK_LIBRARIES(example-libevent hiredis event)
|
2023-05-03 02:34:43 +08:00
|
|
|
+ TARGET_LINK_LIBRARIES(example-libevent hiredis libevent::core)
|
2020-07-16 06:55:31 +08:00
|
|
|
ENDIF()
|
|
|
|
|
2023-05-03 02:34:43 +08:00
|
|
|
-FIND_PATH(LIBUV uv.h)
|
|
|
|
-IF (LIBUV)
|
|
|
|
+find_package(libuv CONFIG REQUIRED)
|
|
|
|
+IF (1)
|
2020-07-16 06:55:31 +08:00
|
|
|
ADD_EXECUTABLE(example-libuv example-libuv.c)
|
|
|
|
- TARGET_LINK_LIBRARIES(example-libuv hiredis uv)
|
2023-05-03 02:34:43 +08:00
|
|
|
+ TARGET_LINK_LIBRARIES(example-libuv hiredis $<IF:$<TARGET_EXISTS:uv_a>,uv_a,uv>)
|
2020-07-16 06:55:31 +08:00
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
IF (APPLE)
|
2020-12-01 02:17:12 +08:00
|
|
|
@@ -38,12 +52,24 @@ IF (APPLE)
|
2020-07-16 06:55:31 +08:00
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
IF (ENABLE_SSL)
|
|
|
|
+ FIND_PACKAGE(OpenSSL REQUIRED)
|
|
|
|
+ IF (WIN32)
|
|
|
|
+ FIND_PACKAGE(pthreads REQUIRED)
|
|
|
|
+ SET(THREADS_LIBS PThreads4W::PThreads4W)
|
|
|
|
+ ELSE()
|
|
|
|
+ FIND_PACKAGE(Threads)
|
|
|
|
+ SET(THREADS_LIBS ${CMAKE_THREAD_LIBS_INIT})
|
|
|
|
+ ENDIF()
|
|
|
|
ADD_EXECUTABLE(example-ssl example-ssl.c)
|
|
|
|
- TARGET_LINK_LIBRARIES(example-ssl hiredis hiredis_ssl)
|
|
|
|
+ if(WIN32)
|
|
|
|
+ TARGET_LINK_LIBRARIES(example-ssl hiredis hiredis_ssl OpenSSL::SSL OpenSSL::Crypto ${THREADS_LIBS} crypt32.lib)
|
|
|
|
+ else()
|
2020-12-01 02:17:12 +08:00
|
|
|
+ TARGET_LINK_LIBRARIES(example-ssl hiredis hiredis_ssl OpenSSL::SSL OpenSSL::Crypto ${THREADS_LIBS})
|
2020-07-16 06:55:31 +08:00
|
|
|
+ endif()
|
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
ADD_EXECUTABLE(example example.c)
|
|
|
|
-TARGET_LINK_LIBRARIES(example hiredis)
|
2021-10-16 10:18:51 +08:00
|
|
|
+TARGET_LINK_LIBRARIES(example hiredis ${LIBEVENT_LIBRARIES})
|
2020-07-16 06:55:31 +08:00
|
|
|
|
2020-12-01 02:17:12 +08:00
|
|
|
ADD_EXECUTABLE(example-push example-push.c)
|
|
|
|
TARGET_LINK_LIBRARIES(example-push hiredis)
|