2009-09-28 19:43:28 +04:00
|
|
|
/*============================================================================
|
|
|
|
CMake - Cross Platform Makefile Generator
|
|
|
|
Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
|
2001-05-23 19:31:43 +04:00
|
|
|
|
2009-09-28 19:43:28 +04:00
|
|
|
Distributed under the OSI-approved BSD License (the "License");
|
|
|
|
see accompanying file Copyright.txt for details.
|
2001-05-23 19:31:43 +04:00
|
|
|
|
2009-09-28 19:43:28 +04:00
|
|
|
This software is distributed WITHOUT ANY WARRANTY; without even the
|
|
|
|
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
See the License for more information.
|
|
|
|
============================================================================*/
|
2001-05-23 19:31:43 +04:00
|
|
|
#include "cmInstallTargetsCommand.h"
|
|
|
|
|
|
|
|
// cmExecutableCommand
|
2016-05-16 17:34:04 +03:00
|
|
|
bool cmInstallTargetsCommand::InitialPass(std::vector<std::string> const& args,
|
|
|
|
cmExecutionStatus&)
|
2001-05-23 19:31:43 +04:00
|
|
|
{
|
2016-05-16 17:34:04 +03:00
|
|
|
if (args.size() < 2) {
|
2001-05-23 19:31:43 +04:00
|
|
|
this->SetError("called with incorrect number of arguments");
|
|
|
|
return false;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2001-05-23 19:31:43 +04:00
|
|
|
|
2006-08-31 18:47:00 +04:00
|
|
|
// Enable the install target.
|
2015-05-03 12:10:30 +03:00
|
|
|
this->Makefile->GetGlobalGenerator()->EnableInstallTarget();
|
2006-08-31 18:47:00 +04:00
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
cmTargets& tgts = this->Makefile->GetTargets();
|
2001-09-20 23:08:30 +04:00
|
|
|
std::vector<std::string>::const_iterator s = args.begin();
|
2001-05-23 19:31:43 +04:00
|
|
|
++s;
|
2004-01-27 20:37:30 +03:00
|
|
|
std::string runtime_dir = "/bin";
|
2016-05-16 17:34:04 +03:00
|
|
|
for (; s != args.end(); ++s) {
|
|
|
|
if (*s == "RUNTIME_DIRECTORY") {
|
2004-01-27 20:37:30 +03:00
|
|
|
++s;
|
2016-05-16 17:34:04 +03:00
|
|
|
if (s == args.end()) {
|
2006-05-11 23:50:11 +04:00
|
|
|
this->SetError("called with RUNTIME_DIRECTORY but no actual "
|
|
|
|
"directory");
|
2004-01-27 20:37:30 +03:00
|
|
|
return false;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2004-01-27 20:37:30 +03:00
|
|
|
|
|
|
|
runtime_dir = *s;
|
2016-05-16 17:34:04 +03:00
|
|
|
} else {
|
2016-09-14 20:42:27 +03: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 19:31:43 +04:00
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2005-12-15 20:01:28 +03:00
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
this->Makefile->GetGlobalGenerator()->AddInstallComponent(
|
|
|
|
this->Makefile->GetSafeDefinition("CMAKE_INSTALL_DEFAULT_COMPONENT_NAME"));
|
2008-07-08 19:52:25 +04:00
|
|
|
|
2001-05-23 19:31:43 +04:00
|
|
|
return true;
|
|
|
|
}
|