FindLibcurl.cmake 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. # Once done these will be defined:
  2. #
  3. # LIBCURL_FOUND
  4. # LIBCURL_INCLUDE_DIRS
  5. # LIBCURL_LIBRARIES
  6. #
  7. # For use in OBS:
  8. #
  9. # CURL_INCLUDE_DIR
  10. find_package(PkgConfig QUIET)
  11. if (PKG_CONFIG_FOUND)
  12. pkg_check_modules(_CURL QUIET curl libcurl)
  13. endif()
  14. if(CMAKE_SIZEOF_VOID_P EQUAL 8)
  15. set(_lib_suffix 64)
  16. else()
  17. set(_lib_suffix 32)
  18. endif()
  19. find_path(CURL_INCLUDE_DIR
  20. NAMES curl/curl.h
  21. HINTS
  22. ENV curlPath${_lib_suffix}
  23. ENV curlPath
  24. ENV DepsPath${_lib_suffix}
  25. ENV DepsPath
  26. ${curlPath${_lib_suffix}}
  27. ${curlPath}
  28. ${DepsPath${_lib_suffix}}
  29. ${DepsPath}
  30. ${_CURL_INCLUDE_DIRS}
  31. PATHS
  32. /usr/include /usr/local/include /opt/local/include /sw/include
  33. PATH_SUFFIXES
  34. include)
  35. if(APPLE)
  36. find_library(CURL_LIB
  37. NAMES ${_CURL_LIBRARIES} curl libcurl
  38. HINTS
  39. ENV curlPath${_lib_suffix}
  40. ENV curlPath
  41. ENV DepsPath${_lib_suffix}
  42. ENV DepsPath
  43. ${curlPath${_lib_suffix}}
  44. ${curlPath}
  45. ${DepsPath${_lib_suffix}}
  46. ${DepsPath}
  47. ${_CURL_LIBRARY_DIRS}
  48. )
  49. else()
  50. find_library(CURL_LIB
  51. NAMES ${_CURL_LIBRARIES} curl libcurl
  52. HINTS
  53. ENV curlPath${_lib_suffix}
  54. ENV curlPath
  55. ENV DepsPath${_lib_suffix}
  56. ENV DepsPath
  57. ${curlPath${_lib_suffix}}
  58. ${curlPath}
  59. ${DepsPath${_lib_suffix}}
  60. ${DepsPath}
  61. ${_CURL_LIBRARY_DIRS}
  62. PATHS
  63. /usr/lib /usr/local/lib /opt/local/lib /sw/lib
  64. PATH_SUFFIXES
  65. lib${_lib_suffix} lib
  66. libs${_lib_suffix} libs
  67. bin${_lib_suffix} bin
  68. ../lib${_lib_suffix} ../lib
  69. ../libs${_lib_suffix} ../libs
  70. ../bin${_lib_suffix} ../bin
  71. "build/Win${_lib_suffix}/VC12/DLL Release - DLL Windows SSPI"
  72. "../build/Win${_lib_suffix}/VC12/DLL Release - DLL Windows SSPI")
  73. endif()
  74. include(FindPackageHandleStandardArgs)
  75. find_package_handle_standard_args(Libcurl DEFAULT_MSG CURL_LIB CURL_INCLUDE_DIR)
  76. mark_as_advanced(CURL_INCLUDE_DIR CURL_LIB)
  77. if(LIBCURL_FOUND)
  78. set(LIBCURL_INCLUDE_DIRS ${CURL_INCLUDE_DIR})
  79. set(LIBCURL_LIBRARIES ${CURL_LIB})
  80. endif()