Add test for new libuv callback styles.

This fixes a build warning on Mac.
This commit is contained in:
Jim Hague 2019-11-13 18:07:31 +00:00
parent 4314f5dbf9
commit 277a4ae9c7
3 changed files with 20 additions and 0 deletions

View File

@ -794,6 +794,12 @@ endif ()
if (USE_LIBUV)
find_package(Libuv)
if (Libuv_FOUND)
# Check for new-style callbacks.
try_compile(HAVE_NEW_UV_TIMER_CB
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/cmake/tests/test_uv_cb.c
)
# Copy module header to getdns include dir.
file(COPY src/getdns/getdns_ext_libuv.h DESTINATION getdns)

View File

@ -207,6 +207,8 @@
#cmakedefine USE_OSX_TCP_FASTOPEN 1
#cmakedefine HAVE_NEW_UV_TIMER_CB 1
#cmakedefine HAVE_TARGET_ENDIANNESS
#cmakedefine TARGET_IS_BIG_ENDIAN

12
cmake/tests/test_uv_cb.c Normal file
View File

@ -0,0 +1,12 @@
#include <uv.h>
void test_cb(uv_timer_t *handle)
{
(void) handle;
}
int main(int ac, char *av[])
{
uv_timer_cb cb = test_cb;
(*cb)(0);
}