2009-10-02 01:21: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-10-02 01:21: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-10-02 01:21: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
|
2006-05-12 21:53:21 +04:00
|
|
|
std::string srcPath =
|
|
|
|
std::string(this->Makefile->GetCurrentDirectory()) +
|
2005-03-14 19:29:15 +03:00
|
|
|
"/" + i->c_str();
|
|
|
|
if (cmSystemTools::FileIsDirectory(srcPath.c_str()))
|
|
|
|
{
|
|
|
|
std::string binPath =
|
2006-03-15 19:02:08 +03:00
|
|
|
std::string(this->Makefile->GetCurrentOutputDirectory()) +
|
2005-03-14 19:29:15 +03:00
|
|
|
"/" + i->c_str();
|
2006-03-15 19:02:08 +03:00
|
|
|
this->Makefile->AddSubDirectory(srcPath.c_str(), binPath.c_str(),
|
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
|
|
|
|
else if ( cmSystemTools::FileIsDirectory(i->c_str()) )
|
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
|
|
|
|
std::string binPath =
|
2006-03-15 19:02:08 +03:00
|
|
|
std::string(this->Makefile->GetCurrentOutputDirectory()) +
|
2005-03-14 19:29:15 +03:00
|
|
|
"/" + cmSystemTools::GetFilenameName(i->c_str());
|
2006-03-15 19:02:08 +03:00
|
|
|
this->Makefile->AddSubDirectory(i->c_str(), binPath.c_str(),
|
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: ";
|
2005-03-14 19:29:15 +03:00
|
|
|
error += *i + " does not exists.";
|
2002-10-24 18:58:25 +04:00
|
|
|
this->SetError(error.c_str());
|
|
|
|
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
|
|
|
}
|
|
|
|
|