From: Guy Harris Date: Mon, 29 Jan 2018 08:57:02 +0000 (-0800) Subject: Use check_symbol_exists for {v}snprintf(). X-Git-Tag: tcpdump-4.99-bp~1329 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/494c8096e0881e4f82440bc7b0b41b6969cd92b9 Use check_symbol_exists for {v}snprintf(). With MSVC 2015, stdio.h defines snprintf() and vsnprintf() as inline functions, so you need to include stdio.h when testing for them - check_function_exists() won't do it, you need check_symbol_exists(). --- diff --git a/CMakeLists.txt b/CMakeLists.txt index c34d21bc..5cc87ded 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -203,8 +203,13 @@ endif(STDLIBS_HAVE_GETSERVENT) cmake_pop_check_state() check_function_exists(getopt_long HAVE_GETOPT_LONG) -check_function_exists(vsnprintf HAVE_VSNPRINTF) -check_function_exists(snprintf HAVE_SNPRINTF) +# +# With MSVC 2015, stdio.h defines snprintf() and vsnprintf() as inline +# functions, so you need to include stdio.h when testing for them - +# check_function_exists() won't do it, you need check_symbol_exists(). +# +check_symbol_exists(vsnprintf stdio.h HAVE_VSNPRINTF) +check_symbol_exists(snprintf stdio.h HAVE_SNPRINTF) check_function_exists(fork HAVE_FORK) check_function_exists(vfork HAVE_VFORK) check_function_exists(strftime HAVE_STRFTIME)