FindLibcurl.cmake 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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. find_library(CURL_LIB
  36. NAMES ${_CURL_LIBRARIES} curl libcurl
  37. HINTS
  38. ENV curlPath${_lib_suffix}
  39. ENV curlPath
  40. ENV DepsPath${_lib_suffix}
  41. ENV DepsPath
  42. ${curlPath${_lib_suffix}}
  43. ${curlPath}
  44. ${DepsPath${_lib_suffix}}
  45. ${DepsPath}
  46. ${_CURL_LIBRARY_DIRS}
  47. PATHS
  48. /usr/lib /usr/local/lib /opt/local/lib /sw/lib
  49. PATH_SUFFIXES
  50. lib${_lib_suffix} lib
  51. libs${_lib_suffix} libs
  52. bin${_lib_suffix} bin
  53. ../lib${_lib_suffix} ../lib
  54. ../libs${_lib_suffix} ../libs
  55. ../bin${_lib_suffix} ../bin
  56. "build/Win${_lib_suffix}/VC12/DLL Release - DLL Windows SSPI"
  57. "../build/Win${_lib_suffix}/VC12/DLL Release - DLL Windows SSPI")
  58. include(FindPackageHandleStandardArgs)
  59. find_package_handle_standard_args(Libcurl DEFAULT_MSG CURL_LIB CURL_INCLUDE_DIR)
  60. mark_as_advanced(CURL_INCLUDE_DIR CURL_LIB)
  61. if(LIBCURL_FOUND)
  62. set(LIBCURL_INCLUDE_DIRS ${CURL_INCLUDE_DIR})
  63. set(LIBCURL_LIBRARIES ${CURL_LIB})
  64. endif()