diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2016-07-12 17:26:55 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2016-09-13 16:47:43 (GMT) |
commit | 42ce9f1e7178b3535726c0c885cc7c9f760cc8b6 (patch) | |
tree | 6ebd228d18eb0b08ff2d950900574dd29caad95d /Source/cmExportCommand.cxx | |
parent | d5257063b04a95aca3d144f860698a3c7181e554 (diff) | |
download | CMake-42ce9f1e7178b3535726c0c885cc7c9f760cc8b6.zip CMake-42ce9f1e7178b3535726c0c885cc7c9f760cc8b6.tar.gz CMake-42ce9f1e7178b3535726c0c885cc7c9f760cc8b6.tar.bz2 |
Add support for creating prebuilt Android.mk files
Add options to the `install()` and `export()` commands to export the
targets we build into Android.mk files that reference them as prebuilt
libraries with associated usage requirements (compile definitions,
include directories, link libraries). This will allow CMake-built
projects to be imported into projects using the Android NDK build
system.
Closes: #15562
Diffstat (limited to 'Source/cmExportCommand.cxx')
-rw-r--r-- | Source/cmExportCommand.cxx | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/Source/cmExportCommand.cxx b/Source/cmExportCommand.cxx index fc62492..134a63f 100644 --- a/Source/cmExportCommand.cxx +++ b/Source/cmExportCommand.cxx @@ -18,6 +18,7 @@ #include <cmsys/Encoding.hxx> #include <cmsys/RegularExpression.hxx> +#include "cmExportBuildAndroidMKGenerator.h" #include "cmExportBuildFileGenerator.h" #if defined(__HAIKU__) @@ -34,6 +35,7 @@ cmExportCommand::cmExportCommand() , Namespace(&Helper, "NAMESPACE", &ArgumentGroup) , Filename(&Helper, "FILE", &ArgumentGroup) , ExportOld(&Helper, "EXPORT_LINK_INTERFACE_LIBRARIES", &ArgumentGroup) + , AndroidMKFile(&Helper, "ANDROID_MK") { this->ExportSet = CM_NULLPTR; } @@ -66,13 +68,18 @@ bool cmExportCommand::InitialPass(std::vector<std::string> const& args, } std::string fname; - if (!this->Filename.WasFound()) { + bool android = false; + if (this->AndroidMKFile.WasFound()) { + fname = this->AndroidMKFile.GetString(); + android = true; + } + if (!this->Filename.WasFound() && fname.empty()) { if (args[0] != "EXPORT") { this->SetError("FILE <filename> option missing."); return false; } fname = this->ExportSetName.GetString() + ".cmake"; - } else { + } else if (fname.empty()) { // Make sure the file has a .cmake extension. if (cmSystemTools::GetFilenameLastExtension(this->Filename.GetCString()) != ".cmake") { @@ -176,7 +183,12 @@ bool cmExportCommand::InitialPass(std::vector<std::string> const& args, } // Setup export file generation. - cmExportBuildFileGenerator* ebfg = new cmExportBuildFileGenerator; + cmExportBuildFileGenerator* ebfg = CM_NULLPTR; + if (android) { + ebfg = new cmExportBuildAndroidMKGenerator; + } else { + ebfg = new cmExportBuildFileGenerator; + } ebfg->SetExportFile(fname.c_str()); ebfg->SetNamespace(this->Namespace.GetCString()); ebfg->SetAppendMode(this->Append.IsEnabled()); |