2009-09-28 11:43:28 -04:00
|
|
|
/*============================================================================
|
|
|
|
CMake - Cross Platform Makefile Generator
|
|
|
|
Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
|
2001-01-11 14:55:47 -05:00
|
|
|
|
2009-09-28 11:43:28 -04:00
|
|
|
Distributed under the OSI-approved BSD License (the "License");
|
|
|
|
see accompanying file Copyright.txt for details.
|
2001-01-11 14:55:47 -05:00
|
|
|
|
2009-09-28 11: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-01-18 11:20:24 -05:00
|
|
|
#include "cmSubdirCommand.h"
|
2001-01-05 11:41:20 -05:00
|
|
|
|
2001-01-18 11:20:24 -05:00
|
|
|
// cmSubdirCommand
|
2016-05-16 10:34:04 -04:00
|
|
|
bool cmSubdirCommand::InitialPass(std::vector<std::string> const& args,
|
|
|
|
cmExecutionStatus&)
|
2001-01-05 11:41:20 -05:00
|
|
|
{
|
2016-09-15 23:59:29 +02:00
|
|
|
if (args.empty()) {
|
2001-01-05 11:41:20 -05:00
|
|
|
this->SetError("called with incorrect number of arguments");
|
|
|
|
return false;
|
2016-05-16 10:34:04 -04:00
|
|
|
}
|
2002-10-24 10:58:25 -04:00
|
|
|
bool res = true;
|
2007-03-12 10:26:59 -04:00
|
|
|
bool excludeFromAll = false;
|
2002-03-29 14:20:32 -05:00
|
|
|
|
2016-05-16 10:34:04 -04:00
|
|
|
for (std::vector<std::string>::const_iterator i = args.begin();
|
|
|
|
i != args.end(); ++i) {
|
|
|
|
if (*i == "EXCLUDE_FROM_ALL") {
|
2007-03-12 10:26:59 -04:00
|
|
|
excludeFromAll = true;
|
2004-03-09 16:28:44 -05:00
|
|
|
continue;
|
2016-05-16 10:34:04 -04:00
|
|
|
}
|
|
|
|
if (*i == "PREORDER") {
|
2015-04-01 20:01:52 +02:00
|
|
|
// Ignored
|
2004-04-23 12:52:48 -04:00
|
|
|
continue;
|
2016-05-16 10:34:04 -04:00
|
|
|
}
|
2005-03-14 11:29:15 -05:00
|
|
|
|
|
|
|
// if they specified a relative path then compute the full
|
2012-08-13 13:42:58 -04:00
|
|
|
std::string srcPath =
|
2016-05-16 10:34:04 -04:00
|
|
|
std::string(this->Makefile->GetCurrentSourceDirectory()) + "/" +
|
|
|
|
i->c_str();
|
|
|
|
if (cmSystemTools::FileIsDirectory(srcPath)) {
|
2012-08-13 13:42:58 -04:00
|
|
|
std::string binPath =
|
2016-05-16 10:34:04 -04:00
|
|
|
std::string(this->Makefile->GetCurrentBinaryDirectory()) + "/" +
|
|
|
|
i->c_str();
|
|
|
|
this->Makefile->AddSubDirectory(srcPath, binPath, excludeFromAll, false);
|
|
|
|
}
|
2005-03-14 11:29:15 -05:00
|
|
|
// otherwise it is a full path
|
2016-05-16 10:34:04 -04:00
|
|
|
else if (cmSystemTools::FileIsDirectory(*i)) {
|
2005-03-14 11:29:15 -05: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 13:42:58 -04:00
|
|
|
std::string binPath =
|
2016-05-16 10:34:04 -04:00
|
|
|
std::string(this->Makefile->GetCurrentBinaryDirectory()) + "/" +
|
|
|
|
cmSystemTools::GetFilenameName(*i);
|
|
|
|
this->Makefile->AddSubDirectory(*i, binPath, excludeFromAll, false);
|
|
|
|
} else {
|
2002-10-24 10:58:25 -04:00
|
|
|
std::string error = "Incorrect SUBDIRS command. Directory: ";
|
2013-05-01 11:36:14 +02:00
|
|
|
error += *i + " does not exist.";
|
2014-03-11 00:04:11 +01:00
|
|
|
this->SetError(error);
|
2002-10-24 10:58:25 -04:00
|
|
|
res = false;
|
2001-01-05 11:41:20 -05:00
|
|
|
}
|
2016-05-16 10:34:04 -04:00
|
|
|
}
|
2002-10-24 10:58:25 -04:00
|
|
|
return res;
|
2001-01-05 11:41:20 -05:00
|
|
|
}
|