axmol/3rdparty/c-ares/CMakeLists.txt

40 lines
918 B
CMake
Raw Normal View History

2023-12-14 04:49:03 +08:00
set(target_name c-ares)
project(${target_name})
2024-01-19 20:33:40 +08:00
_1kfetch_dist(cares)
2023-12-14 04:49:03 +08:00
if(WINDOWS)
add_library(${target_name} SHARED IMPORTED GLOBAL)
else()
add_library(${target_name} STATIC IMPORTED GLOBAL)
endif()
set_target_properties(${target_name} PROPERTIES
2023-12-15 22:29:23 +08:00
INTERFACE_INCLUDE_DIRECTORIES "${cares_INC_DIR}"
2023-12-14 04:49:03 +08:00
INTERFACE_COMPILE_DEFINITIONS CARES_STATICLIB=1
)
if (APPLE)
set_target_properties(${target_name} PROPERTIES
INTERFACE_LINK_LIBRARIES resolv
)
endif()
if(WINDOWS)
set_target_properties(${target_name} PROPERTIES
2023-12-15 22:29:23 +08:00
IMPORTED_IMPLIB "${cares_LIB_DIR}/cares.lib"
2023-12-14 04:49:03 +08:00
)
elseif(APPLE)
set_target_properties(${target_name} PROPERTIES
IMPORTED_LOCATION "${cares_LIB_DIR}/cares.xcframework"
)
2023-12-14 04:49:03 +08:00
else()
set_target_properties(${target_name} PROPERTIES
2023-12-15 22:29:23 +08:00
IMPORTED_LOCATION "${cares_LIB_DIR}/libcares.a"
2023-12-14 04:49:03 +08:00
)
endif()
2023-12-15 22:29:23 +08:00
set(CARES_INCLUDE_DIR "${cares_INC_DIR}" CACHE STRING "c-ares Include Directory" )