summaryrefslogtreecommitdiffstats
path: root/Source/cmExportBuildAndroidMKGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2016-10-07 18:57:26 (GMT)
committerBrad King <brad.king@kitware.com>2016-10-07 19:02:42 (GMT)
commitdda6775c940129d2a38fecd6cf6273f7d97ccca0 (patch)
tree666c16239f6ed691e6575ea0a0d0d75982e033d6 /Source/cmExportBuildAndroidMKGenerator.cxx
parentb99bbfe88d1bb02dc903507f3e1bbe716ac04c12 (diff)
downloadCMake-dda6775c940129d2a38fecd6cf6273f7d97ccca0.zip
CMake-dda6775c940129d2a38fecd6cf6273f7d97ccca0.tar.gz
CMake-dda6775c940129d2a38fecd6cf6273f7d97ccca0.tar.bz2
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++.
Diffstat (limited to 'Source/cmExportBuildAndroidMKGenerator.cxx')
-rw-r--r--Source/cmExportBuildAndroidMKGenerator.cxx12
1 files changed, 12 insertions, 0 deletions
diff --git a/Source/cmExportBuildAndroidMKGenerator.cxx b/Source/cmExportBuildAndroidMKGenerator.cxx
index bb02311..f5e6628 100644
--- a/Source/cmExportBuildAndroidMKGenerator.cxx
+++ b/Source/cmExportBuildAndroidMKGenerator.cxx
@@ -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: