aboutsummaryrefslogtreecommitdiffstats
path: root/ConfigureChecks.cmake
diff options
context:
space:
mode:
authorTsuda Kageyu <tsuda.kageyu@gmail.com>2015-08-01 03:02:48 +0900
committerTsuda Kageyu <tsuda.kageyu@gmail.com>2015-08-01 23:38:50 +0900
commitaa1dd0278d419c86bef7543960dd3bf8629332f0 (patch)
tree02402d65a8760b10e969b717741534faeb5f8bde /ConfigureChecks.cmake
parent13dab99af02557b0dfd27bbcab5cdab333b220d2 (diff)
CMake check for vsprintf_s/vsnprintf rather than sprintf_s/snprintf.
Diffstat (limited to 'ConfigureChecks.cmake')
-rw-r--r--ConfigureChecks.cmake16
1 files changed, 10 insertions, 6 deletions
diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake
index 04f39548..a4a57199 100644
--- a/ConfigureChecks.cmake
+++ b/ConfigureChecks.cmake
@@ -201,26 +201,30 @@ if(NOT HAVE_GCC_BYTESWAP_16 OR NOT HAVE_GCC_BYTESWAP_32 OR NOT HAVE_GCC_BYTESWAP
endif()
endif()
-# Determine whether your compiler supports some safer version of sprintf.
+# Determine whether your compiler supports some safer version of vsprintf.
check_cxx_source_compiles("
#include <cstdio>
+ #include <cstdarg>
int main() {
char buf[20];
- snprintf(buf, 20, \"%d\", 1);
+ va_list args;
+ vsprintf_s(buf, \"%d\", args);
return 0;
}
-" HAVE_SNPRINTF)
+" HAVE_VSPRINTF_S)
-if(NOT HAVE_SNPRINTF)
+if(NOT HAVE_VSPRINTF_S)
check_cxx_source_compiles("
#include <cstdio>
+ #include <cstdarg>
int main() {
char buf[20];
- sprintf_s(buf, \"%d\", 1);
+ va_list args;
+ vsnprintf(buf, 20, \"%d\", args);
return 0;
}
- " HAVE_SPRINTF_S)
+ " HAVE_VSNPRINTF)
endif()
# Check for libz using the cmake supplied FindZLIB.cmake