2009-09-28 19:43:28 +04:00
|
|
|
/*============================================================================
|
|
|
|
CMake - Cross Platform Makefile Generator
|
|
|
|
Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
|
2001-01-11 22:55:47 +03: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-01-11 22:55:47 +03: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-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
|
2008-01-23 18:28:26 +03:00
|
|
|
bool cmSubdirCommand
|
|
|
|
::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
|
2001-01-05 19:41:20 +03:00
|
|
|
{
|
2002-12-12 02:13:33 +03:00
|
|
|
if(args.size() < 1 )
|
2001-01-05 19:41:20 +03:00
|
|
|
{
|
|
|
|
this->SetError("called with incorrect number of arguments");
|
|
|
|
return false;
|
|
|
|
}
|
2002-10-24 18:58:25 +04:00
|
|
|
bool res = true;
|
2007-03-12 17:26:59 +03:00
|
|
|
bool excludeFromAll = false;
|
2004-04-23 20:52:48 +04:00
|
|
|
bool preorder = false;
|
2002-03-29 22:20:32 +03:00
|
|
|
|
2001-09-20 23:08:30 +04:00
|
|
|
for(std::vector<std::string>::const_iterator i = args.begin();
|
2001-01-05 19:41:20 +03:00
|
|
|
i != args.end(); ++i)
|
|
|
|
{
|
2004-03-10 00:28:44 +03:00
|
|
|
if(*i == "EXCLUDE_FROM_ALL")
|
|
|
|
{
|
2007-03-12 17:26:59 +03:00
|
|
|
excludeFromAll = true;
|
2004-03-10 00:28:44 +03:00
|
|
|
continue;
|
|
|
|
}
|
2004-04-23 20:52:48 +04:00
|
|
|
if(*i == "PREORDER")
|
|
|
|
{
|
|
|
|
preorder = true;
|
|
|
|
continue;
|
|
|
|
}
|
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 =
|
|
|
|
std::string(this->Makefile->GetCurrentDirectory()) +
|
2005-03-14 19:29:15 +03:00
|
|
|
"/" + i->c_str();
|
2014-10-15 16:54:05 +04:00
|
|
|
if (cmSystemTools::FileIsDirectory(srcPath))
|
2005-03-14 19:29:15 +03:00
|
|
|
{
|
2012-08-13 21:42:58 +04:00
|
|
|
std::string binPath =
|
|
|
|
std::string(this->Makefile->GetCurrentOutputDirectory()) +
|
2005-03-14 19:29:15 +03:00
|
|
|
"/" + i->c_str();
|
2014-03-11 03:04:11 +04:00
|
|
|
this->Makefile->AddSubDirectory(srcPath, binPath,
|
2007-03-12 17:26:59 +03:00
|
|
|
excludeFromAll, preorder, false);
|
2005-03-14 19:29:15 +03:00
|
|
|
}
|
|
|
|
// otherwise it is a full path
|
2014-10-15 16:54:05 +04:00
|
|
|
else if ( cmSystemTools::FileIsDirectory(*i) )
|
2002-10-24 18:58:25 +04:00
|
|
|
{
|
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 =
|
|
|
|
std::string(this->Makefile->GetCurrentOutputDirectory()) +
|
2014-03-11 03:04:11 +04:00
|
|
|
"/" + cmSystemTools::GetFilenameName(*i);
|
|
|
|
this->Makefile->AddSubDirectory(*i, binPath,
|
2007-03-12 17:26:59 +03:00
|
|
|
excludeFromAll, preorder, false);
|
2002-10-24 18:58:25 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
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
|
|
|
}
|
2002-10-24 18:58:25 +04:00
|
|
|
return res;
|
2001-01-05 19:41:20 +03:00
|
|
|
}
|
|
|
|
|