2016-09-27 22:01:08 +03:00
|
|
|
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
|
|
|
file Copyright.txt or https://cmake.org/licensing for details. */
|
2001-01-18 19:20:24 +03:00
|
|
|
#include "cmSubdirCommand.h"
|
2001-01-05 19:41:20 +03:00
|
|
|
|
2001-01-18 19:20:24 +03:00
|
|
|
// cmSubdirCommand
|
2016-05-16 17:34:04 +03:00
|
|
|
bool cmSubdirCommand::InitialPass(std::vector<std::string> const& args,
|
|
|
|
cmExecutionStatus&)
|
2001-01-05 19:41:20 +03:00
|
|
|
{
|
2016-09-16 00:59:29 +03:00
|
|
|
if (args.empty()) {
|
2001-01-05 19:41:20 +03:00
|
|
|
this->SetError("called with incorrect number of arguments");
|
|
|
|
return false;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2002-10-24 18:58:25 +04:00
|
|
|
bool res = true;
|
2007-03-12 17:26:59 +03:00
|
|
|
bool excludeFromAll = false;
|
2002-03-29 22:20:32 +03:00
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
for (std::vector<std::string>::const_iterator i = args.begin();
|
|
|
|
i != args.end(); ++i) {
|
|
|
|
if (*i == "EXCLUDE_FROM_ALL") {
|
2007-03-12 17:26:59 +03:00
|
|
|
excludeFromAll = true;
|
2004-03-10 00:28:44 +03:00
|
|
|
continue;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
|
|
|
if (*i == "PREORDER") {
|
2015-04-01 21:01:52 +03:00
|
|
|
// Ignored
|
2004-04-23 20:52:48 +04:00
|
|
|
continue;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2005-03-14 19:29:15 +03:00
|
|
|
|
|
|
|
// if they specified a relative path then compute the full
|
2012-08-13 21:42:58 +04:00
|
|
|
std::string srcPath =
|
2016-05-16 17:34:04 +03:00
|
|
|
std::string(this->Makefile->GetCurrentSourceDirectory()) + "/" +
|
|
|
|
i->c_str();
|
|
|
|
if (cmSystemTools::FileIsDirectory(srcPath)) {
|
2012-08-13 21:42:58 +04:00
|
|
|
std::string binPath =
|
2016-05-16 17:34:04 +03:00
|
|
|
std::string(this->Makefile->GetCurrentBinaryDirectory()) + "/" +
|
|
|
|
i->c_str();
|
|
|
|
this->Makefile->AddSubDirectory(srcPath, binPath, excludeFromAll, false);
|
|
|
|
}
|
2005-03-14 19:29:15 +03:00
|
|
|
// otherwise it is a full path
|
2016-05-16 17:34:04 +03:00
|
|
|
else if (cmSystemTools::FileIsDirectory(*i)) {
|
2005-03-14 19:29:15 +03:00
|
|
|
// we must compute the binPath from the srcPath, we just take the last
|
|
|
|
// element from the source path and use that
|
2012-08-13 21:42:58 +04:00
|
|
|
std::string binPath =
|
2016-05-16 17:34:04 +03:00
|
|
|
std::string(this->Makefile->GetCurrentBinaryDirectory()) + "/" +
|
|
|
|
cmSystemTools::GetFilenameName(*i);
|
|
|
|
this->Makefile->AddSubDirectory(*i, binPath, excludeFromAll, false);
|
|
|
|
} else {
|
2002-10-24 18:58:25 +04:00
|
|
|
std::string error = "Incorrect SUBDIRS command. Directory: ";
|
2013-05-01 13:36:14 +04:00
|
|
|
error += *i + " does not exist.";
|
2014-03-11 03:04:11 +04:00
|
|
|
this->SetError(error);
|
2002-10-24 18:58:25 +04:00
|
|
|
res = false;
|
2001-01-05 19:41:20 +03:00
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2002-10-24 18:58:25 +04:00
|
|
|
return res;
|
2001-01-05 19:41:20 +03:00
|
|
|
}
|