2016-09-27 19:01:08 +00:00
|
|
|
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
|
|
|
file Copyright.txt or https://cmake.org/licensing for details. */
|
2001-05-23 15:31:43 +00:00
|
|
|
#include "cmInstallTargetsCommand.h"
|
|
|
|
|
|
|
|
// cmExecutableCommand
|
2016-05-16 14:34:04 +00:00
|
|
|
bool cmInstallTargetsCommand::InitialPass(std::vector<std::string> const& args,
|
|
|
|
cmExecutionStatus&)
|
2001-05-23 15:31:43 +00:00
|
|
|
{
|
2016-05-16 14:34:04 +00:00
|
|
|
if (args.size() < 2) {
|
2001-05-23 15:31:43 +00:00
|
|
|
this->SetError("called with incorrect number of arguments");
|
|
|
|
return false;
|
2016-05-16 14:34:04 +00:00
|
|
|
}
|
2001-05-23 15:31:43 +00:00
|
|
|
|
2006-08-31 14:47:00 +00:00
|
|
|
// Enable the install target.
|
2015-05-03 09:10:30 +00:00
|
|
|
this->Makefile->GetGlobalGenerator()->EnableInstallTarget();
|
2006-08-31 14:47:00 +00:00
|
|
|
|
2016-05-16 14:34:04 +00:00
|
|
|
cmTargets& tgts = this->Makefile->GetTargets();
|
2001-09-20 19:08:30 +00:00
|
|
|
std::vector<std::string>::const_iterator s = args.begin();
|
2001-05-23 15:31:43 +00:00
|
|
|
++s;
|
2004-01-27 17:37:30 +00:00
|
|
|
std::string runtime_dir = "/bin";
|
2016-05-16 14:34:04 +00:00
|
|
|
for (; s != args.end(); ++s) {
|
|
|
|
if (*s == "RUNTIME_DIRECTORY") {
|
2004-01-27 17:37:30 +00:00
|
|
|
++s;
|
2016-05-16 14:34:04 +00:00
|
|
|
if (s == args.end()) {
|
2006-05-11 19:50:11 +00:00
|
|
|
this->SetError("called with RUNTIME_DIRECTORY but no actual "
|
|
|
|
"directory");
|
2004-01-27 17:37:30 +00:00
|
|
|
return false;
|
2016-05-16 14:34:04 +00:00
|
|
|
}
|
2004-01-27 17:37:30 +00:00
|
|
|
|
|
|
|
runtime_dir = *s;
|
2016-05-16 14:34:04 +00:00
|
|
|
} else {
|
2016-09-14 17:42:27 +00:00
|
|
|
cmTargets::iterator ti = tgts.find(*s);
|
|
|
|
if (ti != tgts.end()) {
|
|
|
|
ti->second.SetInstallPath(args[0].c_str());
|
|
|
|
ti->second.SetRuntimeInstallPath(runtime_dir.c_str());
|
|
|
|
ti->second.SetHaveInstallRule(true);
|
|
|
|
} else {
|
|
|
|
std::string str = "Cannot find target: \"" + *s + "\" to install.";
|
|
|
|
this->SetError(str);
|
|
|
|
return false;
|
|
|
|
}
|
2001-05-23 15:31:43 +00:00
|
|
|
}
|
2016-05-16 14:34:04 +00:00
|
|
|
}
|
2005-12-15 17:01:28 +00:00
|
|
|
|
2016-05-16 14:34:04 +00:00
|
|
|
this->Makefile->GetGlobalGenerator()->AddInstallComponent(
|
|
|
|
this->Makefile->GetSafeDefinition("CMAKE_INSTALL_DEFAULT_COMPONENT_NAME"));
|
2008-07-08 15:52:25 +00:00
|
|
|
|
2001-05-23 15:31:43 +00:00
|
|
|
return true;
|
|
|
|
}
|