From: Guy Harris Date: Fri, 9 Aug 2019 18:46:19 +0000 (-0700) Subject: Use check_symbol_exists() for vsnprintf() and snprintf(). X-Git-Tag: tcpdump-4.99-bp~712 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/3a000d8878d64d6637d54362cb6af8cff65bcba3?ds=sidebyside Use check_symbol_exists() for vsnprintf() and snprintf(). At least with Visual Studio, they're inline functions that call a common external function, so check_function_exists() doesn't find them. Clean up indentation while we're at it. --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 1c5f80da..033cef25 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -280,12 +280,15 @@ cmake_pop_check_state() # # Make sure we have vsnprintf() and snprintf(); we require them. +# We use check_symbol_exists(), as they aren't necessarily external +# functions - in Visual Studio, for example, they're inline functions +# calling a common external function. # -check_function_exists(vsnprintf HAVE_VSNPRINTF) +check_symbol_exists(vsnprintf "stdio.h" HAVE_VSNPRINTF) if(NOT HAVE_VSNPRINTF) message(FATAL_ERROR "vsnprintf() is required but wasn't found") endif(NOT HAVE_VSNPRINTF) -check_function_exists(snprintf HAVE_SNPRINTF) +check_symbol_exists(snprintf "stdio.h" HAVE_SNPRINTF) if(NOT HAVE_SNPRINTF) message(FATAL_ERROR "snprintf() is required but wasn't found") endif() @@ -297,8 +300,8 @@ check_function_exists(setlinebuf HAVE_SETLINEBUF) # For Windows, don't need to waste time checking for fork() or vfork(). # if(NOT WIN32) - check_function_exists(fork HAVE_FORK) - check_function_exists(vfork HAVE_VFORK) + check_function_exists(fork HAVE_FORK) + check_function_exists(vfork HAVE_VFORK) endif(NOT WIN32) #