diff options
author | Nick Wellnhofer <wellnhofer@aevum.de> | 2015-05-29 20:47:36 +0200 |
---|---|---|
committer | Nick Wellnhofer <wellnhofer@aevum.de> | 2015-05-29 21:42:46 +0200 |
commit | 0ddadad7333a999ab3289fd6d47433e4984d182e (patch) | |
tree | fc7f9c49a365d713d7a972ce4de4041e7641bb55 /src/CMakeLists.txt | |
parent | b4599a48694b78a5db144f17c2ab281a6d9f17d1 (diff) |
Cope with broken snprintf on Windows
On Windows, snprintf returns -1 if the output was truncated. Fall back to
Windows-specific _scprintf.
Diffstat (limited to 'src/CMakeLists.txt')
-rw-r--r-- | src/CMakeLists.txt | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f27186e..19a5258 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -128,6 +128,7 @@ install(FILES # Feature tests include(CheckIncludeFile) include(CheckCSourceCompiles) +include(CheckCSourceRuns) include(CheckSymbolExists) CHECK_INCLUDE_FILE(stdbool.h HAVE_STDBOOL_H) CHECK_C_SOURCE_COMPILES( @@ -137,6 +138,10 @@ CHECK_C_SOURCE_COMPILES(" int f(void) __attribute__ (()); int main() { return 0; } " HAVE___ATTRIBUTE__) +CHECK_C_SOURCE_RUNS(" + #include <stdio.h> + int main() { return snprintf(NULL, 0, \"123\") == 3 ? 0 : 1; } +" HAVE_C99_SNPRINTF) CHECK_SYMBOL_EXISTS(va_copy stdarg.h HAVE_VA_COPY) CONFIGURE_FILE( @@ -167,4 +172,4 @@ endif($ENV{TIMER}) if(CMAKE_BUILD_TYPE STREQUAL "Ubsan") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=undefined") -endif()
\ No newline at end of file +endif() |