Android.mk: Fix export of static libraries with PRIVATE dependencies

The `LINK_ONLY` generator expression is used to represent private
dependencies of static libraries in their `INTERFACE_LINK_LIBRARIES`
property value.  Fix evaluation of generator expressions during export
to support the `LINK_ONLY` genex.  Extend the RunCMake.AndroidMK test
with a case for this.
This commit is contained in:
Brad King 2018-02-14 11:15:48 -05:00
parent 56e1688517
commit b6d68766b1
2 changed files with 6 additions and 3 deletions

View File

@ -8,6 +8,7 @@
#include <utility>
#include "cmGeneratorExpression.h"
#include "cmGeneratorExpressionDAGChecker.h"
#include "cmGeneratorTarget.h"
#include "cmLinkItem.h"
#include "cmLocalGenerator.h"
@ -104,10 +105,12 @@ void cmExportBuildAndroidMKGenerator::GenerateInterfaceProperties(
// evaluate any generator expressions with the current
// build type of the makefile
cmGeneratorExpression ge;
cmGeneratorExpressionDAGChecker dagChecker(
target->GetName(), "INTERFACE_LINK_LIBRARIES", nullptr, nullptr);
std::unique_ptr<cmCompiledGeneratorExpression> cge =
ge.Parse(property.second);
std::string evaluated =
cge->Evaluate(target->GetLocalGenerator(), config);
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()

View File

@ -4,7 +4,7 @@ add_library(foo foo.cxx)
add_library(car foo.cxx)
add_library(bar bar.c)
add_library(dog foo.cxx)
target_link_libraries(foo car bar dog debug -lm)
target_link_libraries(foo PRIVATE car bar dog debug -lm)
export(TARGETS bar dog car foo ANDROID_MK
${build_BINARY_DIR}/Android.mk)
install(TARGETS bar dog car foo DESTINATION lib EXPORT myexp)