yuzu/externals/vcpkg/ports/hiredis/fix-feature-example.patch
2022-07-23 03:01:36 +02:00

62 lines
2.1 KiB
Diff
Executable File

diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index dd3a313..8c69d3a 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -19,16 +19,25 @@ if (LIBEV)
TARGET_LINK_LIBRARIES(example-libev hiredis ev)
ENDIF()
-FIND_PATH(LIBEVENT event.h)
-if (LIBEVENT)
+FIND_PACKAGE(Libevent CONFIG REQUIRED)
+FIND_PATH(LIBEVENT_INCLUDES evutil.h)
+if (UNIX)
ADD_EXECUTABLE(example-libevent example-libevent)
- TARGET_LINK_LIBRARIES(example-libevent hiredis event)
+ TARGET_LINK_LIBRARIES(example-libevent hiredis ${LIBEVENT_LIBRARIES})
+ TARGET_INCLUDE_DIRECTORIES(example-libevent PRIVATE ${LIBEVENT_INCLUDES})
ENDIF()
+FIND_LIBRARY(UV_LIBRARY libuv)
FIND_PATH(LIBUV uv.h)
IF (LIBUV)
ADD_EXECUTABLE(example-libuv example-libuv.c)
- TARGET_LINK_LIBRARIES(example-libuv hiredis uv)
+ if(WIN32)
+ set(LIB_LISTS Iphlpapi.lib Psapi.lib Userenv.lib)
+ else()
+ set(LIB_LISTS)
+ endif()
+ TARGET_LINK_LIBRARIES(example-libuv hiredis ${UV_LIBRARY} ${LIB_LISTS})
+ TARGET_INCLUDE_DIRECTORIES(example-libuv PRIVATE ${LIBUV})
ENDIF()
IF (APPLE)
@@ -38,12 +52,24 @@ IF (APPLE)
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()
+ TARGET_LINK_LIBRARIES(example-ssl hiredis hiredis_ssl OpenSSL::SSL OpenSSL::Crypto ${THREADS_LIBS})
+ endif()
ENDIF()
ADD_EXECUTABLE(example example.c)
-TARGET_LINK_LIBRARIES(example hiredis)
+TARGET_LINK_LIBRARIES(example hiredis ${LIBEVENT_LIBRARIES})
ADD_EXECUTABLE(example-push example-push.c)
TARGET_LINK_LIBRARIES(example-push hiredis)