浏览代码

Android.mk: De-duplicate link libraries logic during export

Use the normal target link interface computation logic to get the
list of libraries in the link interface instead of trying to
interpret the `INTERFACE_LINK_LIBRARIES` property directly.
Brad King 7 年之前
父节点
当前提交
94a75801c8
共有 1 个文件被更改,包括 5 次插入21 次删除
  1. 5 21
      Source/cmExportBuildAndroidMKGenerator.cxx

+ 5 - 21
Source/cmExportBuildAndroidMKGenerator.cxx

@@ -8,11 +8,8 @@
 #include <utility>
 
 #include "cmAlgorithms.h"
-#include "cmGeneratorExpression.h"
-#include "cmGeneratorExpressionDAGChecker.h"
 #include "cmGeneratorTarget.h"
 #include "cmLinkItem.h"
-#include "cmLocalGenerator.h"
 #include "cmMakefile.h"
 #include "cmPolicies.h"
 #include "cmStateTypes.h"
@@ -104,27 +101,14 @@ void cmExportBuildAndroidMKGenerator::GenerateInterfaceProperties(
         os << "LOCAL_CPP_FEATURES += ";
         os << (property.second) << "\n";
       } else if (property.first == "INTERFACE_LINK_LIBRARIES") {
-        // evaluate any generator expressions with the current
-        // build type of the makefile
-        cmGeneratorExpression ge;
-        cmGeneratorExpressionDAGChecker dagChecker(
-          target, "INTERFACE_LINK_LIBRARIES", nullptr, nullptr);
-        std::unique_ptr<cmCompiledGeneratorExpression> cge =
-          ge.Parse(property.second);
-        std::string evaluated = cge->Evaluate(
-          target->GetLocalGenerator(), config, false, target, &dagChecker);
-        // need to look at list in pi->second and see if static or shared
-        // FindTargetToLink
-        // target->GetLocalGenerator()->FindGeneratorTargetToUse()
-        // then add to LOCAL_CPPFLAGS
-        std::vector<std::string> libraries;
-        cmSystemTools::ExpandListArgument(evaluated, libraries);
         std::string staticLibs;
         std::string sharedLibs;
         std::string ldlibs;
-        for (std::string const& lib : libraries) {
-          cmGeneratorTarget* gt =
-            target->GetLocalGenerator()->FindGeneratorTargetToUse(lib);
+        cmLinkInterfaceLibraries const* linkIFace =
+          target->GetLinkInterfaceLibraries(config, target, false);
+        for (cmLinkItem const& item : linkIFace->Libraries) {
+          cmGeneratorTarget const* gt = item.Target;
+          std::string const& lib = item.AsStr();
           if (gt) {
 
             if (gt->GetType() == cmStateEnums::SHARED_LIBRARY ||