OpenSSL.cmake 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. # -*- cmake -*-
  2. if (OPENSSL_CMAKE_INCLUDED)
  3. return()
  4. endif (OPENSSL_CMAKE_INCLUDED)
  5. set (OPENSSL_CMAKE_INCLUDED TRUE)
  6. if (NOT CURL_CMAKE_INCLUDED)
  7. message(FATAL_ERROR "OpenSSL.cmake must not be included manually: use include(CURL) instead !")
  8. endif (NOT CURL_CMAKE_INCLUDED)
  9. set(OpenSSL_FIND_QUIETLY ON)
  10. set(OpenSSL_FIND_REQUIRED OFF)
  11. # Disable system libraries for OpenSSL, because we want to use our own patched
  12. # curl versions (with HTTP/1.1 support), at least until HTTP/2 is enabled in SL
  13. # servers... OPENSSL_FOUND will be OFF as a result of disabling the three
  14. # following lines, and consequently our pre-built curl (and nghttp2, if needed)
  15. # will be loaded by CURL.cmake (and NGHTTP2.cmake).
  16. #if (USESYSTEMLIBS AND USE_NEW_LIBCURL)
  17. # include(FindOpenSSL)
  18. #endif (USESYSTEMLIBS AND USE_NEW_LIBCURL)
  19. if (NOT OPENSSL_FOUND OR OPENSSL_VERSION VERSION_LESS "1.0" OR NOT (OPENSSL_VERSION VERSION_LESS "1.2"))
  20. set(OPENSSL_FOUND OFF)
  21. if (USE_NEW_LIBCURL)
  22. use_prebuilt_binary(openssl)
  23. else (USE_NEW_LIBCURL)
  24. use_prebuilt_binary(openssl_old)
  25. endif (USE_NEW_LIBCURL)
  26. if (WINDOWS)
  27. if (USE_NEW_LIBCURL)
  28. set(OPENSSL_LIBRARIES libssl libcrypto)
  29. else (USE_NEW_LIBCURL)
  30. set(OPENSSL_LIBRARIES ssleay32 libeay32)
  31. endif (USE_NEW_LIBCURL)
  32. else (WINDOWS)
  33. set(OPENSSL_LIBRARIES ssl)
  34. endif (WINDOWS)
  35. set(OPENSSL_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include)
  36. endif ()
  37. if (LINUX)
  38. set(CRYPTO_LIBRARIES crypto dl)
  39. elseif (DARWIN)
  40. set(CRYPTO_LIBRARIES crypto)
  41. endif (LINUX)
  42. include_directories(SYSTEM ${OPENSSL_INCLUDE_DIRS})