From e19f2ffa6322de454cfaf6e89f1f184c273506c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20S=2E=20Ga=C3=9Fmann?= Date: Fri, 11 Sep 2015 00:45:53 +0200 Subject: [PATCH] FIX CMake snprintf DETECTION Replace check_function_exists calls with check_symbol_exists calls for snprintf detection because starting with MSVC 19 snprintf is declared as an inline function thus check_function_exists fails to detect it. (See http://public.kitware.com/Bug/view.php?id=15659) --- CMakeLists.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bfe8604..bad9e8a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -100,6 +100,7 @@ include (CheckFunctionExists) include (CheckFunctionKeywords) include (CheckIncludeFiles) include (CheckTypeSize) +include (CheckSymbolExists) if (MSVC) # Turn off Microsofts "security" warnings. @@ -304,8 +305,8 @@ else() endif() # Find our snprintf -check_function_exists (snprintf HAVE_SNPRINTF) -check_function_exists (_snprintf HAVE__SNPRINTF) +check_symbol_exists(snprintf stdio.h HAVE_SNPRINTF) +check_symbol_exists(_snprintf stdio.h HAVE__SNPRINTF) if (HAVE_SNPRINTF) set(JSON_SNPRINTF snprintf)