2001-01-11 22:55:47 +03:00
|
|
|
/*=========================================================================
|
|
|
|
|
2002-10-24 02:03:27 +04:00
|
|
|
Program: CMake - Cross-Platform Makefile Generator
|
2001-01-11 22:55:47 +03:00
|
|
|
Module: $RCSfile$
|
|
|
|
Language: C++
|
|
|
|
Date: $Date$
|
|
|
|
Version: $Revision$
|
|
|
|
|
2002-10-24 02: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 22:55:47 +03:00
|
|
|
|
2002-01-21 23:30:43 +03: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 22:55:47 +03:00
|
|
|
|
|
|
|
=========================================================================*/
|
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
|
2002-12-12 02:13:33 +03:00
|
|
|
bool cmSubdirCommand::InitialPass(std::vector<std::string> const& args)
|
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;
|
2004-03-10 00:28:44 +03:00
|
|
|
bool intoplevel = true;
|
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")
|
|
|
|
{
|
|
|
|
intoplevel = false;
|
|
|
|
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
|
|
|
|
std::string srcPath = std::string(m_Makefile->GetCurrentDirectory()) +
|
|
|
|
"/" + i->c_str();
|
|
|
|
if (cmSystemTools::FileIsDirectory(srcPath.c_str()))
|
|
|
|
{
|
|
|
|
std::string binPath =
|
|
|
|
std::string(m_Makefile->GetCurrentOutputDirectory()) +
|
|
|
|
"/" + i->c_str();
|
|
|
|
m_Makefile->AddSubDirectory(srcPath.c_str(), binPath.c_str(),
|
|
|
|
intoplevel, preorder);
|
|
|
|
}
|
|
|
|
// 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 =
|
|
|
|
std::string(m_Makefile->GetCurrentOutputDirectory()) +
|
|
|
|
"/" + cmSystemTools::GetFilenameName(i->c_str());
|
|
|
|
m_Makefile->AddSubDirectory(i->c_str(), binPath.c_str(),
|
|
|
|
intoplevel, preorder);
|
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
|
|
|
}
|
|
|
|
|