0001-CMakeLists.txt-do-not-force-SHARED.patch 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. From 0ce382c275b087e866517c003e565f8cc4855bdd Mon Sep 17 00:00:00 2001
  2. From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
  3. Date: Sat, 29 Aug 2020 23:19:26 +0200
  4. Subject: [PATCH] CMakeLists.txt: do not force SHARED
  5. Allow the user to build static libraries by removing SHARED from
  6. ADD_LIBRARY calls.
  7. Here is an extract of
  8. https://cmake.org/cmake/help/latest/command/add_library.html:
  9. "If no type is given explicitly the type is STATIC or SHARED based on
  10. whether the current value of the variable BUILD_SHARED_LIBS is ON."
  11. Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
  12. [Upstream status: probably not upstreamable as is because it will
  13. conflict with https://github.com/redis/hiredis/pull/851. So, this patch
  14. will probably have to be reworked for 1.0.x]
  15. ---
  16. CMakeLists.txt | 4 ++--
  17. 1 file changed, 2 insertions(+), 2 deletions(-)
  18. diff --git a/CMakeLists.txt b/CMakeLists.txt
  19. index 1beccc6..fed79fd 100644
  20. --- a/CMakeLists.txt
  21. +++ b/CMakeLists.txt
  22. @@ -40,7 +40,7 @@ IF(WIN32)
  23. ADD_COMPILE_DEFINITIONS(_CRT_SECURE_NO_WARNINGS WIN32_LEAN_AND_MEAN)
  24. ENDIF()
  25. -ADD_LIBRARY(hiredis SHARED ${hiredis_sources})
  26. +ADD_LIBRARY(hiredis ${hiredis_sources})
  27. SET_TARGET_PROPERTIES(hiredis
  28. PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE
  29. @@ -97,7 +97,7 @@ IF(ENABLE_SSL)
  30. FIND_PACKAGE(OpenSSL REQUIRED)
  31. SET(hiredis_ssl_sources
  32. ssl.c)
  33. - ADD_LIBRARY(hiredis_ssl SHARED
  34. + ADD_LIBRARY(hiredis_ssl
  35. ${hiredis_ssl_sources})
  36. IF (APPLE)
  37. --
  38. 2.28.0