message("${Y}==== 进入find_curl.cmake ====${E}")

set(USE_CURL OFF)

if (DEFINED PATH_CURL AND NOT "${PATH_CURL}" STREQUAL "")
    file(TO_CMAKE_PATH ${PATH_CURL} PATH_CURL)
    if (EXISTS ${PATH_CURL})
        message("找到CURL库根目录")
        # 寻找OPENSSL
        if (NOT ${USE_SSL})
            message(FATAL_ERROR "未成功配置OpenSSL,无法启用本CURL库")
        endif ()
        # 寻找zlib
        if (NOT ${USE_ZLIB})
            message(FATAL_ERROR "未成功配置ZLIB,无法启用本CURL库")
        endif ()
        # 寻找libpsl
        # 寻找libidn2
        # 寻找nghttp2

        set(CURL_DIR ${PATH_CURL}/lib/cmake/CURL)
        find_package(CURL CONFIG REQUIRED)
        list(APPEND CMAKE_PREFIX_PATH ${PATH_CURL})
        message("添加CURL库成功,将启用CURL")
        set(USE_CURL ON)
    else ()
        message("curl库目录配置错误,不启用curl")
    endif ()
else ()
    message("未配置curl根目录,不启用curl")
endif ()


