avrdude: Use C99, fix alloca include in stk500

This commit is contained in:
Vojtech Kral 2018-05-15 16:16:09 +02:00
parent af360d7097
commit 4ac17daad2
2 changed files with 11 additions and 1 deletions

View file

@ -2,6 +2,13 @@
remove_definitions(-D_UNICODE -DUNICODE)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_C_STANDARD 99)
set(CMAKE_C_STANDARD_REQUIRED ON)
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
# Workaround for an old CMake, which does not understand CMAKE_C_STANDARD.
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -Wall")
endif()
set(AVRDUDE_SOURCES
@ -64,6 +71,7 @@ if (WIN32)
)
endif()
add_library(avrdude STATIC ${AVRDUDE_SOURCES})
if (WIN32)
target_compile_definitions(avrdude PRIVATE WIN32NATIVE=1)
target_include_directories(avrdude SYSTEM PRIVATE ${LIBDIR}/avrdude/windows) # So that sources find the getopt.h windows drop-in

View file

@ -35,7 +35,9 @@
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <malloc.h>
#if defined(WIN32NATIVE)
# include <malloc.h> /* for alloca() */
#endif
#include "avrdude.h"
#include "libavrdude.h"