From b6d68766b1a8537a3a130a38aa91936e579da6fd Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 14 Feb 2018 11:15:48 -0500 Subject: 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. --- Source/cmExportBuildAndroidMKGenerator.cxx | 7 +++++-- Tests/RunCMake/AndroidMK/AndroidMK.cmake | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Source/cmExportBuildAndroidMKGenerator.cxx b/Source/cmExportBuildAndroidMKGenerator.cxx index 5bfae1e..817b5d9 100644 --- a/Source/cmExportBuildAndroidMKGenerator.cxx +++ b/Source/cmExportBuildAndroidMKGenerator.cxx @@ -8,6 +8,7 @@ #include #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 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() diff --git a/Tests/RunCMake/AndroidMK/AndroidMK.cmake b/Tests/RunCMake/AndroidMK/AndroidMK.cmake index 2596e8c..3fbb2cf 100644 --- a/Tests/RunCMake/AndroidMK/AndroidMK.cmake +++ b/Tests/RunCMake/AndroidMK/AndroidMK.cmake @@ -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) -- cgit v0.12