From 24538afeaf610429726c28456ebd8c5bc8652f25 Mon Sep 17 00:00:00 2001 From: Sharaf Zaman Date: Mon, 15 Apr 2019 01:05:07 +0530 Subject: Detect duplicate ANDROID_EXTRA_LIBS and minor bug fix Summary: Don't include same dependency twice, one which was found from `readelf` in `specifydependencies.cmake` and other in `ANDROID_EXTRA_LIBS`. Bug fix: find stl was dependent on the order in which libc++ was added, now it is independent. Test Plan: * add the same dependency in ANDROID_EXTRA_LIBS Reviewers: apol, vkrause Reviewed By: apol Subscribers: kde-buildsystem, kde-frameworks-devel Tags: #frameworks, #build_system Differential Revision: https://phabricator.kde.org/D20509 --- toolchain/specifydependencies.cmake | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'toolchain/specifydependencies.cmake') diff --git a/toolchain/specifydependencies.cmake b/toolchain/specifydependencies.cmake index 942e88e2..d21250c1 100644 --- a/toolchain/specifydependencies.cmake +++ b/toolchain/specifydependencies.cmake @@ -21,10 +21,29 @@ foreach(line ${lines}) endif() endforeach() +function(contains_library libpath IS_EQUAL) + get_filename_component (name ${libpath} NAME) + unset (IS_EQUAL PARENT_SCOPE) + + foreach (extralib ${extralibs}) + get_filename_component (extralibname ${extralib} NAME) + if (${extralibname} STREQUAL ${name}) + set (IS_EQUAL TRUE PARENT_SCOPE) + break() + endif() + endforeach() +endfunction() + if (ANDROID_EXTRA_LIBS) foreach (extralib ${ANDROID_EXTRA_LIBS}) - message(STATUS "manually specified extra library: " ${extralib}) - list(APPEND extralibs ${extralib}) + contains_library(${extralib} IS_EQUAL) + + if (IS_EQUAL) + message (STATUS "found duplicate, skipping: " ${extralib}) + else() + message(STATUS "manually specified extra library: " ${extralib}) + list(APPEND extralibs ${extralib}) + endif() endforeach() endif() -- cgit v1.2.1