From f62793d36e34371f6e4a5da2d74ca7ccb400f395 Mon Sep 17 00:00:00 2001 From: pkerling Date: Wed, 11 Mar 2015 08:01:54 +0100 Subject: [PATCH 1/2] Fix CMP0038 warnings on CMake >= 3.0 As of CMake 3.0, targets may not link to themselves in target_link_libraries. Doing so displays a warning (policy CMP0038). This change makes sure that a library will not be considered a dependency of itself. --- cmake/Platform/Arduino.cmake | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cmake/Platform/Arduino.cmake b/cmake/Platform/Arduino.cmake index 042a3c1..29e4d28 100644 --- a/cmake/Platform/Arduino.cmake +++ b/cmake/Platform/Arduino.cmake @@ -988,8 +988,12 @@ function(setup_arduino_library VAR_NAME BOARD_ID LIB_PATH COMPILE_FLAGS LINK_FLA foreach(LIB_DEP ${LIB_DEPS}) setup_arduino_library(DEP_LIB_SRCS ${BOARD_ID} ${LIB_DEP} "${COMPILE_FLAGS}" "${LINK_FLAGS}") - list(APPEND LIB_TARGETS ${DEP_LIB_SRCS}) - list(APPEND LIB_INCLUDES ${DEP_LIB_SRCS_INCLUDES}) + # Do not link to this library. DEP_LIB_SRCS will always be only one entry + # if we are looking at the same library. + if(NOT DEP_LIB_SRCS STREQUAL TARGET_LIB_NAME) + list(APPEND LIB_TARGETS ${DEP_LIB_SRCS}) + list(APPEND LIB_INCLUDES ${DEP_LIB_SRCS_INCLUDES}) + endif() endforeach() if (LIB_INCLUDES) From 29da21f8f5c17dc9f45e76b6d5107876136727e4 Mon Sep 17 00:00:00 2001 From: Joao Carrilho Date: Wed, 9 Aug 2017 16:46:27 +0100 Subject: [PATCH 2/2] added ":a" to avrdude options, to make it work in windows. without the fourth option, the colon in "C:/path.to.source" makes avrdude stop with error "invalid file format". see Note for [:format] option in http://www.nongnu.org/avrdude/user-manual/avrdude_4.html --- cmake/Platform/Arduino.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/Platform/Arduino.cmake b/cmake/Platform/Arduino.cmake index 042a3c1..0f0f383 100644 --- a/cmake/Platform/Arduino.cmake +++ b/cmake/Platform/Arduino.cmake @@ -1174,7 +1174,7 @@ function(setup_arduino_bootloader_upload TARGET_NAME BOARD_ID PORT AVRDUDE_FLAGS endif() set(TARGET_PATH ${EXECUTABLE_OUTPUT_PATH}/${TARGET_NAME}) - list(APPEND AVRDUDE_ARGS "-Uflash:w:${TARGET_PATH}.hex") + list(APPEND AVRDUDE_ARGS "-Uflash:w:${TARGET_PATH}.hex:a") list(APPEND AVRDUDE_ARGS "-Ueeprom:w:${TARGET_PATH}.eep:i") add_custom_target(${UPLOAD_TARGET} ${ARDUINO_AVRDUDE_PROGRAM} @@ -1222,7 +1222,7 @@ function(setup_arduino_programmer_burn TARGET_NAME BOARD_ID PROGRAMMER PORT AVRD endif() set(TARGET_PATH ${EXECUTABLE_OUTPUT_PATH}/${TARGET_NAME}) - list(APPEND AVRDUDE_ARGS "-Uflash:w:${TARGET_PATH}.hex") + list(APPEND AVRDUDE_ARGS "-Uflash:w:${TARGET_PATH}.hex:a") add_custom_target(${PROGRAMMER_TARGET} ${ARDUINO_AVRDUDE_PROGRAM}