summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2019-08-09 11:46:19 -0700
committerGuy Harris <guy@alum.mit.edu>2019-08-09 11:46:19 -0700
commit3a000d8878d64d6637d54362cb6af8cff65bcba3 (patch)
tree698517698630f6e355e0c7c00838df4849981719 /CMakeLists.txt
parent1ed63b5d0630a4b5b4a8d31174d9f3e95a970913 (diff)
downloadtcpdump-3a000d8878d64d6637d54362cb6af8cff65bcba3.tar.gz
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.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt11
1 files changed, 7 insertions, 4 deletions
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)
#