From f3ce787870d09cc7d28ae1f985d58aa039993bcf Mon Sep 17 00:00:00 2001 From: Romain Forlot Date: Mon, 17 Dec 2018 16:35:03 +0100 Subject: Avoid a target to link against itself If you have specified in your project to link against a project internal library then the cmake templates should take care to avoid to link a target against itself. Bug-AGL: SPEC-1997 Change-Id: I6959247ab350474533fb8df1c1e912aa203f36b5 Signed-off-by: Romain Forlot --- src/cmake/cmake.d/03-macros.cmake | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/cmake/cmake.d/03-macros.cmake b/src/cmake/cmake.d/03-macros.cmake index 2d961a4..3ca6311 100644 --- a/src/cmake/cmake.d/03-macros.cmake +++ b/src/cmake/cmake.d/03-macros.cmake @@ -365,9 +365,12 @@ macro(project_targets_populate) ${TYPE} STREQUAL "INTERFACE_LIBRARY" OR ${TYPE} STREQUAL "EXECUTABLE" ) - set_property(TARGET ${TARGET} APPEND PROPERTY LINK_LIBRARIES ${link_libraries}) + foreach(linked_lib ${link_libraries}) + if(NOT ${linked_lib} STREQUAL ${TARGET}) + set_property(TARGET ${TARGET} APPEND PROPERTY LINK_LIBRARIES ${linked_lib}) + endif() + endforeach(linked_lib ${${link_libraries}}) endif() - get_target_property(SUBTYPE ${TARGET} LABELS) if(SUBTYPE) get_target_property(P ${TARGET} PREFIX) -- cgit 1.2.3-korg