From f62793d36e34371f6e4a5da2d74ca7ccb400f395 Mon Sep 17 00:00:00 2001 From: pkerling Date: Wed, 11 Mar 2015 08:01:54 +0100 Subject: [PATCH] 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)