From: Jehan Date: Wed, 15 Apr 2020 11:01:09 +0000 (+0200) Subject: CMakeLists: do not enforce strict prototypes on Windows. X-Git-Tag: json-c-0.14-20200419~11^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F581%2Fhead;p=thirdparty%2Fjson-c.git CMakeLists: do not enforce strict prototypes on Windows. On Windows, or at least when cross-built with Mingw-w64, build fails because strict prototype fails on an included file (thus nothing we can do about in json-c code): > from /home/jehan/dev/src/json-c/json_util.c:44: > /home/jehan/.local/share/crossroad/roads/w64/json-c/include/minwindef.h:196:3: error: function declaration isn't a prototype [-Werror=strict-prototypes] > 196 | typedef INT_PTR (WINAPI *FARPROC) (); > | ^~~~~~~ > /home/jehan/.local/share/crossroad/roads/w64/json-c/include/minwindef.h:197:3: error: function declaration isn't a prototype [-Werror=strict-prototypes] > 197 | typedef INT_PTR (WINAPI *NEARPROC) (); > | ^~~~~~~ > /home/jehan/.local/share/crossroad/roads/w64/json-c/include/minwindef.h:198:3: error: function declaration isn't a prototype [-Werror=strict-prototypes] > 198 | typedef INT_PTR (WINAPI *PROC) (); > | ^~~~~~~ Let's just disable the errors for Windows build. --- diff --git a/CMakeLists.txt b/CMakeLists.txt index c645d58a..60b50fc9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -240,7 +240,9 @@ if ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wextra") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wwrite-strings") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-parameter") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wstrict-prototypes") + if (NOT WIN32) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wstrict-prototypes") + endif() add_definitions(-D_GNU_SOURCE) elseif ("${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC")