CMakeLists.txt 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. INCLUDE(FindPkgConfig)
  2. # Check for GLib
  3. PKG_CHECK_MODULES(GLIB2 glib-2.0)
  4. if (GLIB2_FOUND)
  5. INCLUDE_DIRECTORIES(${GLIB2_INCLUDE_DIRS})
  6. LINK_DIRECTORIES(${GLIB2_LIBRARY_DIRS})
  7. ADD_EXECUTABLE(example-glib example-glib.c)
  8. TARGET_LINK_LIBRARIES(example-glib hiredis ${GLIB2_LIBRARIES})
  9. ENDIF(GLIB2_FOUND)
  10. FIND_PATH(LIBEV ev.h
  11. HINTS /usr/local /usr/opt/local
  12. ENV LIBEV_INCLUDE_DIR)
  13. if (LIBEV)
  14. # Just compile and link with libev
  15. ADD_EXECUTABLE(example-libev example-libev.c)
  16. TARGET_LINK_LIBRARIES(example-libev hiredis ev)
  17. ENDIF()
  18. FIND_PATH(LIBEVENT event.h)
  19. if (LIBEVENT)
  20. ADD_EXECUTABLE(example-libevent example-libevent)
  21. TARGET_LINK_LIBRARIES(example-libevent hiredis event)
  22. ENDIF()
  23. FIND_PATH(LIBUV uv.h)
  24. IF (LIBUV)
  25. ADD_EXECUTABLE(example-libuv example-libuv.c)
  26. TARGET_LINK_LIBRARIES(example-libuv hiredis uv)
  27. ENDIF()
  28. IF (APPLE)
  29. FIND_LIBRARY(CF CoreFoundation)
  30. ADD_EXECUTABLE(example-macosx example-macosx.c)
  31. TARGET_LINK_LIBRARIES(example-macosx hiredis ${CF})
  32. ENDIF()
  33. IF (ENABLE_SSL)
  34. ADD_EXECUTABLE(example-ssl example-ssl.c)
  35. TARGET_LINK_LIBRARIES(example-ssl hiredis hiredis_ssl)
  36. ENDIF()
  37. ADD_EXECUTABLE(example example.c)
  38. TARGET_LINK_LIBRARIES(example hiredis)