[Cmake-commits] CMake branch, next, updated. v3.7.0-rc1-217-g4b64d26

Brad King brad.king at kitware.com
Fri Oct 7 15:29:45 EDT 2016


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  4b64d265ee79a39aabe6241f3e0811f38c0c2177 (commit)
       via  dda6775c940129d2a38fecd6cf6273f7d97ccca0 (commit)
      from  c207eccdf8224900f5d44ead6f8ee2fb89c9bfc1 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4b64d265ee79a39aabe6241f3e0811f38c0c2177
commit 4b64d265ee79a39aabe6241f3e0811f38c0c2177
Merge: c207ecc dda6775
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Fri Oct 7 15:29:43 2016 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Fri Oct 7 15:29:43 2016 -0400

    Merge topic 'android-export-has-cpp' into next
    
    dda6775c Android: Record use of C++ by static libs in exported Android.mk files


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=dda6775c940129d2a38fecd6cf6273f7d97ccca0
commit dda6775c940129d2a38fecd6cf6273f7d97ccca0
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Fri Oct 7 14:57:26 2016 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Fri Oct 7 15:02:42 2016 -0400

    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++.

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:
diff --git a/Tests/RunCMake/AndroidMK/AndroidMK.cmake b/Tests/RunCMake/AndroidMK/AndroidMK.cmake
index ed21e58..2596e8c 100644
--- a/Tests/RunCMake/AndroidMK/AndroidMK.cmake
+++ b/Tests/RunCMake/AndroidMK/AndroidMK.cmake
@@ -2,7 +2,7 @@ project(build)
 set(CMAKE_BUILD_TYPE Debug)
 add_library(foo foo.cxx)
 add_library(car foo.cxx)
-add_library(bar  foo.cxx)
+add_library(bar bar.c)
 add_library(dog  foo.cxx)
 target_link_libraries(foo car bar dog debug -lm)
 export(TARGETS bar dog car foo  ANDROID_MK
diff --git a/Tests/RunCMake/AndroidMK/bar.c b/Tests/RunCMake/AndroidMK/bar.c
new file mode 100644
index 0000000..e1f4df6
--- /dev/null
+++ b/Tests/RunCMake/AndroidMK/bar.c
@@ -0,0 +1,3 @@
+void bar(void)
+{
+}
diff --git a/Tests/RunCMake/AndroidMK/expectedBuildAndroidMK.txt b/Tests/RunCMake/AndroidMK/expectedBuildAndroidMK.txt
index def8fcb..bbf67a5 100644
--- a/Tests/RunCMake/AndroidMK/expectedBuildAndroidMK.txt
+++ b/Tests/RunCMake/AndroidMK/expectedBuildAndroidMK.txt
@@ -7,11 +7,13 @@ include.*PREBUILT_STATIC_LIBRARY.*
 include.*CLEAR_VARS.*
 LOCAL_MODULE.*dog
 LOCAL_SRC_FILES.*.*dog.*
+LOCAL_HAS_CPP := true
 include.*PREBUILT_STATIC_LIBRARY.*
 .*
 include.*CLEAR_VARS.*
 LOCAL_MODULE.*car
 LOCAL_SRC_FILES.*.*car.*
+LOCAL_HAS_CPP := true
 include.*PREBUILT_STATIC_LIBRARY.*
 .*
 include.*CLEAR_VARS.*
@@ -20,4 +22,5 @@ LOCAL_SRC_FILES.*.*foo.*
 LOCAL_CPP_FEATURES.*rtti exceptions
 LOCAL_STATIC_LIBRARIES.*car bar dog
 LOCAL_EXPORT_LDLIBS := -lm
+LOCAL_HAS_CPP := true
 include.*PREBUILT_STATIC_LIBRARY.*
diff --git a/Tests/RunCMake/AndroidMK/expectedInstallAndroidMK.txt b/Tests/RunCMake/AndroidMK/expectedInstallAndroidMK.txt
index 1bdb308..3515fb9 100644
--- a/Tests/RunCMake/AndroidMK/expectedInstallAndroidMK.txt
+++ b/Tests/RunCMake/AndroidMK/expectedInstallAndroidMK.txt
@@ -9,11 +9,13 @@ include.*PREBUILT_STATIC_LIBRARY.*
 include.*CLEAR_VARS.
 LOCAL_MODULE.*dog
 LOCAL_SRC_FILES.*_IMPORT_PREFIX./lib.*dog.*
+LOCAL_HAS_CPP := true
 include.*PREBUILT_STATIC_LIBRARY.*
 
 include.*CLEAR_VARS.*
 LOCAL_MODULE.*car
 LOCAL_SRC_FILES.*_IMPORT_PREFIX./lib.*car.*
+LOCAL_HAS_CPP := true
 include.*PREBUILT_STATIC_LIBRARY.*
 
 include.*CLEAR_VARS.*
@@ -22,4 +24,5 @@ LOCAL_SRC_FILES.*_IMPORT_PREFIX\)/lib.*foo.*
 LOCAL_CPP_FEATURES.*rtti exceptions
 LOCAL_STATIC_LIBRARIES.*car bar dog
 LOCAL_EXPORT_LDLIBS := -lm
+LOCAL_HAS_CPP := true
 include.*PREBUILT_STATIC_LIBRARY.*

-----------------------------------------------------------------------

Summary of changes:
 Source/cmExportBuildAndroidMKGenerator.cxx            |   12 ++++++++++++
 Tests/RunCMake/AndroidMK/AndroidMK.cmake              |    2 +-
 Tests/RunCMake/AndroidMK/bar.c                        |    3 +++
 Tests/RunCMake/AndroidMK/expectedBuildAndroidMK.txt   |    3 +++
 Tests/RunCMake/AndroidMK/expectedInstallAndroidMK.txt |    3 +++
 5 files changed, 22 insertions(+), 1 deletion(-)
 create mode 100644 Tests/RunCMake/AndroidMK/bar.c


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list