Android: Record use of C++ by static libs in exported Android.mk files

When a `PREBUILT_STATIC_LIBRARY` uses C++ in its sources then the `.a`
file will have a link-time dependency on the C++ runtime libraries.
Android NDK r14 will add a way to give this information to the NDK build
system by adding a `LOCAL_HAS_CPP` setting to the `Android.mk` file.
Add this for exported static libraries that use C++.
This commit is contained in:
Brad King
2016-10-07 14:57:26 -04:00
parent b99bbfe88d
commit dda6775c94
5 changed files with 22 additions and 1 deletions

View File

@@ -9,6 +9,8 @@
#include "cmMakefile.h"
#include "cmTargetExport.h"
#include <algorithm>
cmExportBuildAndroidMKGenerator::cmExportBuildAndroidMKGenerator()
{
this->LG = CM_NULLPTR;
@@ -164,6 +166,16 @@ void cmExportBuildAndroidMKGenerator::GenerateInterfaceProperties(
}
}
}
// Tell the NDK build system if prebuilt static libraries use C++.
if (target->GetType() == cmState::STATIC_LIBRARY) {
cmLinkImplementation const* li = target->GetLinkImplementation(config);
if (std::find(li->Languages.begin(), li->Languages.end(), "CXX") !=
li->Languages.end()) {
os << "LOCAL_HAS_CPP := true\n";
}
}
switch (target->GetType()) {
case cmState::SHARED_LIBRARY:
case cmState::MODULE_LIBRARY: