From 8076d2b6edbda02b7ff4a8aa946d01c40b0ee29b Mon Sep 17 00:00:00 2001 From: Yuchen Zeng Date: Thu, 25 Aug 2016 13:23:13 -0700 Subject: Build c-ares with cmake --- src/c-ares/CMakeLists.txt | 15 +++++++++++++++ src/c-ares/config_linux/ares_config.h | 8 ++++---- 2 files changed, 19 insertions(+), 4 deletions(-) create mode 100644 src/c-ares/CMakeLists.txt (limited to 'src/c-ares') diff --git a/src/c-ares/CMakeLists.txt b/src/c-ares/CMakeLists.txt new file mode 100644 index 0000000000..87c86fa045 --- /dev/null +++ b/src/c-ares/CMakeLists.txt @@ -0,0 +1,15 @@ +string(TOLOWER ${CMAKE_SYSTEM_NAME} cares_system_name) + +include_directories(${CMAKE_CURRENT_SOURCE_DIR}) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../third_party/c-ares) + +if(${cares_system_name} MATCHES windows) + add_definitions(-DCARES_STATICLIB=1) + add_definitions(-DWIN32_LEAN_AND_MEAN=1) +else() + include_directories(${CMAKE_CURRENT_SOURCE_DIR}/config_${cares_system_name}) + add_definitions(-DHAVE_CONFIG_H=1) +endif() + +file(GLOB lib_sources ../../third_party/c-ares/*.c) +add_library(cares ${lib_sources}) diff --git a/src/c-ares/config_linux/ares_config.h b/src/c-ares/config_linux/ares_config.h index 8296bb7b17..265974cfae 100644 --- a/src/c-ares/config_linux/ares_config.h +++ b/src/c-ares/config_linux/ares_config.h @@ -352,7 +352,7 @@ /* #undef NEED_THREAD_SAFE */ /* cpu-machine-OS */ -#define OS "x86_64-unknown-linux-gnu" +#define OS "i386-unknown-linux-gnu" /* Name of package */ #define PACKAGE "c-ares" @@ -451,13 +451,13 @@ #define SIZEOF_INT 4 /* The size of `long', as computed by sizeof. */ -#define SIZEOF_LONG 8 +#define SIZEOF_LONG 4 /* The size of `short', as computed by sizeof. */ #define SIZEOF_SHORT 2 /* The size of `size_t', as computed by sizeof. */ -#define SIZEOF_SIZE_T 8 +#define SIZEOF_SIZE_T 4 /* The size of `struct in6_addr', as computed by sizeof. */ #define SIZEOF_STRUCT_IN6_ADDR 16 @@ -466,7 +466,7 @@ #define SIZEOF_STRUCT_IN_ADDR 4 /* The size of `time_t', as computed by sizeof. */ -#define SIZEOF_TIME_T 8 +#define SIZEOF_TIME_T 4 /* Define to 1 if you have the ANSI C header files. */ #define STDC_HEADERS 1 -- cgit v1.2.3