summaryrefslogtreecommitdiffstats
path: root/Source/cmInstallCommand.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmInstallCommand.cxx')
-rw-r--r--Source/cmInstallCommand.cxx120
1 files changed, 112 insertions, 8 deletions
diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx
index 4912eac..8450360 100644
--- a/Source/cmInstallCommand.cxx
+++ b/Source/cmInstallCommand.cxx
@@ -71,19 +71,28 @@ bool cmInstallCommand::InitialPass(std::vector<std::string> const& args,
// Switch among the command modes.
if (args[0] == "SCRIPT") {
return this->HandleScriptMode(args);
- } else if (args[0] == "CODE") {
+ }
+ if (args[0] == "CODE") {
return this->HandleScriptMode(args);
- } else if (args[0] == "TARGETS") {
+ }
+ if (args[0] == "TARGETS") {
return this->HandleTargetsMode(args);
- } else if (args[0] == "FILES") {
+ }
+ if (args[0] == "FILES") {
return this->HandleFilesMode(args);
- } else if (args[0] == "PROGRAMS") {
+ }
+ if (args[0] == "PROGRAMS") {
return this->HandleFilesMode(args);
- } else if (args[0] == "DIRECTORY") {
+ }
+ if (args[0] == "DIRECTORY") {
return this->HandleDirectoryMode(args);
- } else if (args[0] == "EXPORT") {
+ }
+ if (args[0] == "EXPORT") {
return this->HandleExportMode(args);
}
+ if (args[0] == "EXPORT_ANDROID_MK") {
+ return this->HandleExportAndroidMKMode(args);
+ }
// Unknown mode.
std::string e = "called with unknown mode ";
@@ -338,7 +347,8 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
<< "\" which is not an executable, library, or module.";
this->SetError(e.str());
return false;
- } else if (target->GetType() == cmState::OBJECT_LIBRARY) {
+ }
+ if (target->GetType() == cmState::OBJECT_LIBRARY) {
std::ostringstream e;
e << "TARGETS given OBJECT library \"" << (*targetIt)
<< "\" which may not be installed.";
@@ -1097,6 +1107,100 @@ bool cmInstallCommand::HandleDirectoryMode(
return true;
}
+bool cmInstallCommand::HandleExportAndroidMKMode(
+ std::vector<std::string> const& args)
+{
+#ifdef CMAKE_BUILD_WITH_CMAKE
+ // This is the EXPORT mode.
+ cmInstallCommandArguments ica(this->DefaultComponentName);
+ cmCAString exp(&ica.Parser, "EXPORT_ANDROID_MK");
+ cmCAString name_space(&ica.Parser, "NAMESPACE", &ica.ArgumentGroup);
+ cmCAEnabler exportOld(&ica.Parser, "EXPORT_LINK_INTERFACE_LIBRARIES",
+ &ica.ArgumentGroup);
+ cmCAString filename(&ica.Parser, "FILE", &ica.ArgumentGroup);
+ exp.Follows(CM_NULLPTR);
+
+ ica.ArgumentGroup.Follows(&exp);
+ std::vector<std::string> unknownArgs;
+ ica.Parse(&args, &unknownArgs);
+
+ if (!unknownArgs.empty()) {
+ // Unknown argument.
+ std::ostringstream e;
+ e << args[0] << " given unknown argument \"" << unknownArgs[0] << "\".";
+ this->SetError(e.str());
+ return false;
+ }
+
+ if (!ica.Finalize()) {
+ return false;
+ }
+
+ // Make sure there is a destination.
+ if (ica.GetDestination().empty()) {
+ // A destination is required.
+ std::ostringstream e;
+ e << args[0] << " given no DESTINATION!";
+ this->SetError(e.str());
+ return false;
+ }
+
+ // Check the file name.
+ std::string fname = filename.GetString();
+ if (fname.find_first_of(":/\\") != fname.npos) {
+ std::ostringstream e;
+ e << args[0] << " given invalid export file name \"" << fname << "\". "
+ << "The FILE argument may not contain a path. "
+ << "Specify the path in the DESTINATION argument.";
+ this->SetError(e.str());
+ return false;
+ }
+
+ // Check the file extension.
+ if (!fname.empty() &&
+ cmSystemTools::GetFilenameLastExtension(fname) != ".mk") {
+ std::ostringstream e;
+ e << args[0] << " given invalid export file name \"" << fname << "\". "
+ << "The FILE argument must specify a name ending in \".mk\".";
+ this->SetError(e.str());
+ return false;
+ }
+ if (fname.find_first_of(":/\\") != fname.npos) {
+ std::ostringstream e;
+ e << args[0] << " given export name \"" << exp.GetString() << "\". "
+ << "This name cannot be safely converted to a file name. "
+ << "Specify a different export name or use the FILE option to set "
+ << "a file name explicitly.";
+ this->SetError(e.str());
+ return false;
+ }
+ // Use the default name
+ if (fname.empty()) {
+ fname = "Android.mk";
+ }
+
+ cmExportSet* exportSet =
+ this->Makefile->GetGlobalGenerator()->GetExportSets()[exp.GetString()];
+
+ cmInstallGenerator::MessageLevel message =
+ cmInstallGenerator::SelectMessageLevel(this->Makefile);
+
+ // Create the export install generator.
+ cmInstallExportGenerator* exportGenerator = new cmInstallExportGenerator(
+ exportSet, ica.GetDestination().c_str(), ica.GetPermissions().c_str(),
+ ica.GetConfigurations(), ica.GetComponent().c_str(), message,
+ ica.GetExcludeFromAll(), fname.c_str(), name_space.GetCString(),
+ exportOld.IsEnabled(), true);
+ this->Makefile->AddInstallGenerator(exportGenerator);
+
+ return true;
+#else
+ static_cast<void>(args);
+ this->SetError("EXPORT_ANDROID_MK not supported in bootstrap cmake");
+ return false;
+#endif
+}
+
bool cmInstallCommand::HandleExportMode(std::vector<std::string> const& args)
{
// This is the EXPORT mode.
@@ -1203,7 +1307,7 @@ bool cmInstallCommand::HandleExportMode(std::vector<std::string> const& args)
exportSet, ica.GetDestination().c_str(), ica.GetPermissions().c_str(),
ica.GetConfigurations(), ica.GetComponent().c_str(), message,
ica.GetExcludeFromAll(), fname.c_str(), name_space.GetCString(),
- exportOld.IsEnabled());
+ exportOld.IsEnabled(), false);
this->Makefile->AddInstallGenerator(exportGenerator);
return true;