From 1d6128d1fe76e6148cd9955db38be39481526f65 Mon Sep 17 00:00:00 2001 From: elivdahan Date: Mon, 1 Apr 2019 09:38:20 +0300 Subject: [PATCH] cmake: Fix bzero mis-detection on MinGW Using a C compiler ignores non-existent functions, and tries to link them anyway. The compiler optimizes `bzero(buf, 1)` to `movb $0x0,0xf(%esp)`, so bzero is not called at all, and the linker succeeds. Increase the buffer size to 100 to avoid this optimization. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dd52e052b..db4e8c246 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -723,7 +723,7 @@ endif() CHECK_C_SOURCE_COMPILES( "#include - int main(int argc, char **argv) { char buf[1]; bzero(buf, 1); return 0; } + int main(int argc, char **argv) { char buf[100]; bzero(buf, 100); return 0; } " LWS_HAVE_BZERO) CHECK_C_SOURCE_COMPILES( "#include