CURL.cmake 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. set(_curl_platform_flags
  2. -DENABLE_IPV6:BOOL=ON
  3. -DENABLE_VERSIONED_SYMBOLS:BOOL=ON
  4. -DENABLE_THREADED_RESOLVER:BOOL=ON
  5. # -DCURL_DISABLE_LDAP:BOOL=ON
  6. # -DCURL_DISABLE_LDAPS:BOOL=ON
  7. -DENABLE_MANUAL:BOOL=OFF
  8. # -DCURL_DISABLE_RTSP:BOOL=ON
  9. # -DCURL_DISABLE_DICT:BOOL=ON
  10. # -DCURL_DISABLE_TELNET:BOOL=ON
  11. # -DCURL_DISABLE_POP3:BOOL=ON
  12. # -DCURL_DISABLE_IMAP:BOOL=ON
  13. # -DCURL_DISABLE_SMB:BOOL=ON
  14. # -DCURL_DISABLE_SMTP:BOOL=ON
  15. # -DCURL_DISABLE_GOPHER:BOOL=ON
  16. -DHTTP_ONLY=ON
  17. -DCMAKE_USE_GSSAPI:BOOL=OFF
  18. -DCMAKE_USE_LIBSSH2:BOOL=OFF
  19. -DUSE_RTMP:BOOL=OFF
  20. -DUSE_NGHTTP2:BOOL=OFF
  21. -DUSE_MBEDTLS:BOOL=OFF
  22. )
  23. if (WIN32)
  24. set(_curl_platform_flags ${_curl_platform_flags} -DCMAKE_USE_SCHANNEL=ON)
  25. elseif (APPLE)
  26. set(_curl_platform_flags
  27. ${_curl_platform_flags}
  28. -DCMAKE_USE_SECTRANSP:BOOL=ON
  29. -DCMAKE_USE_OPENSSL:BOOL=OFF
  30. -DCURL_CA_PATH:STRING=none
  31. )
  32. elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
  33. set(_curl_platform_flags
  34. ${_curl_platform_flags}
  35. -DCMAKE_USE_OPENSSL:BOOL=ON
  36. -DCURL_CA_PATH:STRING=none
  37. -DCURL_CA_BUNDLE:STRING=none
  38. -DCURL_CA_FALLBACK:BOOL=ON
  39. )
  40. endif ()
  41. set(_patch_command "")
  42. if (UNIX AND NOT APPLE)
  43. # On non-apple UNIX platforms, finding the location of OpenSSL certificates is necessary at runtime, as there is no standard location usable across platforms.
  44. # The OPENSSL_CERT_OVERRIDE flag is understood by PrusaSlicer and will trigger the search of certificates at initial application launch.
  45. # Then ask the user for consent about the correctness of the found location.
  46. set (_patch_command echo set_target_properties(CURL::libcurl PROPERTIES INTERFACE_COMPILE_DEFINITIONS OPENSSL_CERT_OVERRIDE) >> CMake/curl-config.cmake.in)
  47. endif ()
  48. if (IS_CROSS_COMPILE AND APPLE)
  49. # TODO
  50. endif ()
  51. prusaslicer_add_cmake_project(CURL
  52. # GIT_REPOSITORY https://github.com/curl/curl.git
  53. # GIT_TAG curl-7_75_0
  54. URL https://github.com/curl/curl/archive/refs/tags/curl-7_75_0.zip
  55. URL_HASH SHA256=a63ae025bb0a14f119e73250f2c923f4bf89aa93b8d4fafa4a9f5353a96a765a
  56. DEPENDS ${ZLIB_PKG}
  57. # PATCH_COMMAND ${GIT_EXECUTABLE} checkout -f -- . && git clean -df &&
  58. # ${GIT_EXECUTABLE} apply --whitespace=fix ${CMAKE_CURRENT_LIST_DIR}/curl-mods.patch
  59. PATCH_COMMAND "${_patch_command}"
  60. CMAKE_ARGS
  61. -DBUILD_TESTING:BOOL=OFF
  62. -DCMAKE_POSITION_INDEPENDENT_CODE=ON
  63. ${_curl_platform_flags}
  64. )
  65. if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
  66. add_dependencies(dep_CURL dep_OpenSSL)
  67. endif ()
  68. if (MSVC)
  69. add_debug_dep(dep_CURL)
  70. endif ()