2001-01-11 14:55:47 -05:00
|
|
|
/*=========================================================================
|
|
|
|
|
2002-10-23 18:03:27 -04:00
|
|
|
Program: CMake - Cross-Platform Makefile Generator
|
2001-01-11 14:55:47 -05:00
|
|
|
Module: $RCSfile$
|
|
|
|
Language: C++
|
|
|
|
Date: $Date$
|
|
|
|
Version: $Revision$
|
|
|
|
|
2002-10-23 18:03:27 -04:00
|
|
|
Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
|
|
|
|
See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
|
2001-01-11 14:55:47 -05:00
|
|
|
|
2002-01-21 15:30:43 -05:00
|
|
|
This software is distributed WITHOUT ANY WARRANTY; without even
|
|
|
|
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
|
PURPOSE. See the above copyright notices for more information.
|
2001-01-11 14:55:47 -05:00
|
|
|
|
|
|
|
=========================================================================*/
|
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
|
2002-12-11 18:13:33 -05:00
|
|
|
bool cmSubdirCommand::InitialPass(std::vector<std::string> const& args)
|
2001-01-05 11:41:20 -05:00
|
|
|
{
|
2002-12-11 18:13:33 -05:00
|
|
|
if(args.size() < 1 )
|
2001-01-05 11:41:20 -05:00
|
|
|
{
|
|
|
|
this->SetError("called with incorrect number of arguments");
|
|
|
|
return false;
|
|
|
|
}
|
2002-10-24 10:58:25 -04:00
|
|
|
bool res = true;
|
2004-03-09 16:28:44 -05:00
|
|
|
bool intoplevel = true;
|
2004-04-23 12:52:48 -04:00
|
|
|
bool preorder = false;
|
2002-03-29 14:20:32 -05:00
|
|
|
|
2001-09-20 15:08:30 -04:00
|
|
|
for(std::vector<std::string>::const_iterator i = args.begin();
|
2001-01-05 11:41:20 -05:00
|
|
|
i != args.end(); ++i)
|
|
|
|
{
|
2004-03-09 16:28:44 -05:00
|
|
|
if(*i == "EXCLUDE_FROM_ALL")
|
|
|
|
{
|
|
|
|
intoplevel = false;
|
|
|
|
continue;
|
|
|
|
}
|
2004-04-23 12:52:48 -04:00
|
|
|
if(*i == "PREORDER")
|
|
|
|
{
|
|
|
|
preorder = true;
|
|
|
|
continue;
|
|
|
|
}
|
2005-03-14 11:29:15 -05:00
|
|
|
|
|
|
|
// if they specified a relative path then compute the full
|
2006-05-12 13:53:21 -04:00
|
|
|
std::string srcPath =
|
|
|
|
std::string(this->Makefile->GetCurrentDirectory()) +
|
2005-03-14 11:29:15 -05:00
|
|
|
"/" + i->c_str();
|
|
|
|
if (cmSystemTools::FileIsDirectory(srcPath.c_str()))
|
|
|
|
{
|
|
|
|
std::string binPath =
|
2006-03-15 11:02:08 -05:00
|
|
|
std::string(this->Makefile->GetCurrentOutputDirectory()) +
|
2005-03-14 11:29:15 -05:00
|
|
|
"/" + i->c_str();
|
2006-03-15 11:02:08 -05:00
|
|
|
this->Makefile->AddSubDirectory(srcPath.c_str(), binPath.c_str(),
|
2005-03-18 10:41:41 -05:00
|
|
|
intoplevel, preorder, false);
|
2005-03-14 11:29:15 -05:00
|
|
|
}
|
|
|
|
// otherwise it is a full path
|
|
|
|
else if ( cmSystemTools::FileIsDirectory(i->c_str()) )
|
2002-10-24 10:58:25 -04:00
|
|
|
{
|
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
|
|
|
|
std::string binPath =
|
2006-03-15 11:02:08 -05:00
|
|
|
std::string(this->Makefile->GetCurrentOutputDirectory()) +
|
2005-03-14 11:29:15 -05:00
|
|
|
"/" + cmSystemTools::GetFilenameName(i->c_str());
|
2006-03-15 11:02:08 -05:00
|
|
|
this->Makefile->AddSubDirectory(i->c_str(), binPath.c_str(),
|
2005-03-18 10:41:41 -05:00
|
|
|
intoplevel, preorder, false);
|
2002-10-24 10:58:25 -04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
std::string error = "Incorrect SUBDIRS command. Directory: ";
|
2005-03-14 11:29:15 -05:00
|
|
|
error += *i + " does not exists.";
|
2002-10-24 10:58:25 -04:00
|
|
|
this->SetError(error.c_str());
|
|
|
|
res = false;
|
|
|
|
}
|
2001-01-05 11:41:20 -05:00
|
|
|
}
|
2002-10-24 10:58:25 -04:00
|
|
|
return res;
|
2001-01-05 11:41:20 -05:00
|
|
|
}
|
|
|
|
|