From fb0ff3f02cd51d85240a249de46842baae0225ee Mon Sep 17 00:00:00 2001 From: halx99 Date: Tue, 6 Feb 2024 00:32:19 +0800 Subject: [PATCH] Fix c-ares link issue --- 1k/fetch.cmake | 8 +++++++- thirdparty/yasio/CMakeLists.txt | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/1k/fetch.cmake b/1k/fetch.cmake index 33b2075588..982af51e6a 100644 --- a/1k/fetch.cmake +++ b/1k/fetch.cmake @@ -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 diff --git a/thirdparty/yasio/CMakeLists.txt b/thirdparty/yasio/CMakeLists.txt index 910a63bc9b..9401d073e3 100644 --- a/thirdparty/yasio/CMakeLists.txt +++ b/thirdparty/yasio/CMakeLists.txt @@ -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})