summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2018-02-14 11:09:55 -0500
committerBrad King <brad.king@kitware.com>2018-02-14 11:19:47 -0500
commit56e1688517ab040cf9554926070830df475980b3 (patch)
treedd621d43a7e1cac986e4066d72fb01c0532e9976
parent9c1efb614dee294cb3a1077e8a232573f309c605 (diff)
downloadcmake-56e1688517ab040cf9554926070830df475980b3.tar.gz
Android.mk: Evaluate generator expressions up front
When exporting `INTERFACE_LINK_LIBRARIES`, we must evaluate generator expressions first, before expanding the `;` list, in case they contain or generate semicolons.
-rw-r--r--Source/cmExportBuildAndroidMKGenerator.cxx25
1 files changed, 13 insertions, 12 deletions
diff --git a/Source/cmExportBuildAndroidMKGenerator.cxx b/Source/cmExportBuildAndroidMKGenerator.cxx
index 6f31a2d7fa..5bfae1e7d1 100644
--- a/Source/cmExportBuildAndroidMKGenerator.cxx
+++ b/Source/cmExportBuildAndroidMKGenerator.cxx
@@ -101,12 +101,19 @@ 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;
+ std::unique_ptr<cmCompiledGeneratorExpression> cge =
+ ge.Parse(property.second);
+ std::string evaluated =
+ cge->Evaluate(target->GetLocalGenerator(), config);
// 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(property.second, libraries);
+ cmSystemTools::ExpandListArgument(evaluated, libraries);
std::string staticLibs;
std::string sharedLibs;
std::string ldlibs;
@@ -122,12 +129,6 @@ void cmExportBuildAndroidMKGenerator::GenerateInterfaceProperties(
staticLibs += " " + lib;
}
} else {
- // evaluate any generator expressions with the current
- // build type of the makefile
- cmGeneratorExpression ge;
- std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(lib);
- std::string evaluated =
- cge->Evaluate(target->GetLocalGenerator(), config);
bool relpath = false;
if (type == cmExportBuildAndroidMKGenerator::INSTALL) {
relpath = lib.substr(0, 3) == "../";
@@ -135,12 +136,12 @@ void cmExportBuildAndroidMKGenerator::GenerateInterfaceProperties(
// check for full path or if it already has a -l, or
// in the case of an install check for relative paths
// if it is full or a link library then use string directly
- if (cmSystemTools::FileIsFullPath(evaluated) ||
- evaluated.substr(0, 2) == "-l" || relpath) {
- ldlibs += " " + evaluated;
+ if (cmSystemTools::FileIsFullPath(lib) ||
+ lib.substr(0, 2) == "-l" || relpath) {
+ ldlibs += " " + lib;
// if it is not a path and does not have a -l then add -l
- } else if (!evaluated.empty()) {
- ldlibs += " -l" + evaluated;
+ } else if (!lib.empty()) {
+ ldlibs += " -l" + lib;
}
}
}