axmol/thirdparty/c-ares/CMakeLists.txt

38 lines
885 B
CMake
Raw Normal View History

2020-11-16 14:47:43 +08:00
2023-06-28 00:44:29 +08:00
set(target_name c-ares)
2020-11-16 14:47:43 +08:00
2023-06-28 00:44:29 +08:00
project(${target_name})
2020-11-16 14:47:43 +08:00
2023-06-28 00:44:29 +08:00
include(AXPlatform)
2020-11-16 14:47:43 +08:00
2023-06-28 00:44:29 +08:00
axpkg_require(cares ${CMAKE_CURRENT_LIST_DIR})
2020-11-16 14:47:43 +08:00
2023-06-28 00:44:29 +08:00
if(WINDOWS)
add_library(${target_name} SHARED IMPORTED GLOBAL)
else()
add_library(${target_name} STATIC IMPORTED GLOBAL)
endif()
2020-11-16 14:47:43 +08:00
2023-06-28 00:44:29 +08:00
set_target_properties(${target_name} PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/include/"
INTERFACE_COMPILE_DEFINITIONS CARES_STATICLIB=1
2020-11-16 14:47:43 +08:00
)
2023-06-28 00:44:29 +08:00
if (APPLE)
set_target_properties(${target_name} PROPERTIES
INTERFACE_LINK_LIBRARIES resolv
)
endif()
if(WINDOWS)
set_target_properties(${target_name} PROPERTIES
IMPORTED_IMPLIB "${platform_spec_path}/cares.lib"
)
else()
set_target_properties(${target_name} PROPERTIES
IMPORTED_LOCATION "${platform_spec_path}/libcares.a"
)
endif()
set(CARES_INCLUDE_DIR "${CMAKE_CURRENT_LIST_DIR}/include" CACHE STRING "c-ares Include Directory" )