CURL.cmake 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. # -*- cmake -*-
  2. if (CURL_CMAKE_INCLUDED)
  3. return()
  4. endif (CURL_CMAKE_INCLUDED)
  5. set (CURL_CMAKE_INCLUDED TRUE)
  6. include(00-BuildOptions)
  7. include(Prebuilt)
  8. # Curl depends on OpenSSL...
  9. include(OpenSSL)
  10. if (USE_NEW_LIBCURL)
  11. # The new lib curl versions depend on nghttp2...
  12. include(NGHTTP2)
  13. # When the OpenSSL version present on the system does not match the ones we
  14. # support (v1.0 or v1.1), OPENSSL_FOUND is set to OFF by OpenSSL.cmake, and
  15. # our custom OpenSSL is then used, which mandates using our custom curl as
  16. # well !
  17. if (USESYSTEMLIBS AND OPENSSL_FOUND)
  18. set(CURL_FIND_QUIETLY ON)
  19. set(CURL_FIND_REQUIRED ON)
  20. include(FindCURL)
  21. endif (USESYSTEMLIBS AND OPENSSL_FOUND)
  22. endif (USE_NEW_LIBCURL)
  23. if (NOT CURL_INCLUDE_DIRS OR NOT CURL_LIBRARIES)
  24. if (USE_NEW_LIBCURL)
  25. use_prebuilt_binary(curl)
  26. else (USE_NEW_LIBCURL)
  27. use_prebuilt_binary(curl_old)
  28. endif (USE_NEW_LIBCURL)
  29. if (WINDOWS)
  30. add_definitions(-DCURL_STATICLIB=1)
  31. set(CURL_LIBRARIES libcurl)
  32. else (WINDOWS)
  33. set(CURL_LIBRARIES curl)
  34. endif (WINDOWS)
  35. set(CURL_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include)
  36. endif (NOT CURL_INCLUDE_DIRS OR NOT CURL_LIBRARIES)
  37. include_directories(SYSTEM ${CURL_INCLUDE_DIRS})