aboutsummaryrefslogtreecommitdiff
path: root/ports/czmq/Findlibcurl.cmake
blob: 6c943e2d71c7383c4c9fa34024128cedcb976fed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
find_path(
    LIBCURL_INCLUDE_DIRS
    NAMES curl/curl.h
)

find_library(
    LIBCURL_LIBRARY_DEBUG
    NAMES libcurl-d_imp libcurl-d curl-d curl
)

find_library(
    LIBCURL_LIBRARY_RELEASE
    NAMES libcurl_imp libcurl curl
)

include(SelectLibraryConfigurations)
select_library_configurations(LIBCURL)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(
    LIBCURL
    REQUIRED_VARS LIBCURL_LIBRARIES LIBCURL_INCLUDE_DIRS
)

# CURL dependencies
# https://github.com/Microsoft/vcpkg/issues/4312
# https://github.com/microsoft/vcpkg/commit/ee325d14276e7bd7961e94e58293b02d6e9e92da
# https://github.com/microsoft/vcpkg/pull/6698
if (LIBCURL_FOUND)
    find_package(OpenSSL QUIET)
    find_package(ZLIB QUIET)

    if (OPENSSL_FOUND)
        list(APPEND LIBCURL_LIBRARIES
            OpenSSL::SSL
            OpenSSL::Crypto  
        )
    endif ()

    if (ZLIB_FOUND)
        list(APPEND LIBCURL_LIBRARIES
            ZLIB::ZLIB    
        )
    endif ()

    if (WIN32)
        list(APPEND LIBCURL_LIBRARIES
            Crypt32
        )
    endif ()
endif ()