Fix c-ares link issue

This commit is contained in:
halx99 2024-02-06 00:32:19 +08:00
parent 7dd7dc4ada
commit fb0ff3f02c
2 changed files with 8 additions and 1 deletions

View File

@ -34,11 +34,17 @@ function(_1kfetch_dist package_name)
list(GET _status 0 status_code)
list(GET _status 1 status_string)
if(NOT status_code EQUAL 0)
file(REMOVE ${package_store})
message(FATAL_ERROR "Download ${package_url} fail, ${status_string}, logs: ${_logs}")
endif()
endif()
file(ARCHIVE_EXTRACT INPUT ${package_store} DESTINATION ${CMAKE_CURRENT_LIST_DIR}/)
file(RENAME ${CMAKE_CURRENT_LIST_DIR}/${package_name} ${_prebuilt_root})
if (IS_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/${package_name})
file(RENAME ${CMAKE_CURRENT_LIST_DIR}/${package_name} ${_prebuilt_root})
else() # download may fail
file(REMOVE ${package_store})
message(FATAL_ERROR "The package ${package_store} is malformed, please try again!")
endif()
endif()
# set platform specific path, PLATFORM_NAME provided by user: win32,winrt,mac,ios,android,tvos,watchos,linux

View File

@ -30,6 +30,7 @@ target_include_directories(${target_name} PUBLIC ${CMAKE_CURRENT_LIST_DIR})
if(CARES_INCLUDE_DIR)
target_compile_definitions(${target_name} PUBLIC YASIO_USE_CARES=1)
target_include_directories(${target_name} PUBLIC ${CARES_INCLUDE_DIR})
target_link_libraries(${target_name} PUBLIC c-ares)
endif()
target_include_directories(${target_name} PUBLIC ${OPENSSL_INCLUDE_DIR})