1 /*============================================================================
2 CMake - Cross Platform Makefile Generator
3 Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
5 Distributed under the OSI-approved BSD License (the "License");
6 see accompanying file Copyright.txt for details.
8 This software is distributed WITHOUT ANY WARRANTY; without even the
9 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 See the License for more information.
11 ============================================================================*/
12 #include "cmSubdirCommand.h"
16 ::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
20 this->SetError("called with incorrect number of arguments");
24 bool excludeFromAll = false;
25 bool preorder = false;
27 for(std::vector<std::string>::const_iterator i = args.begin();
30 if(*i == "EXCLUDE_FROM_ALL")
32 excludeFromAll = true;
41 // if they specified a relative path then compute the full
43 std::string(this->Makefile->GetCurrentDirectory()) +
45 if (cmSystemTools::FileIsDirectory(srcPath.c_str()))
48 std::string(this->Makefile->GetCurrentOutputDirectory()) +
50 this->Makefile->AddSubDirectory(srcPath.c_str(), binPath.c_str(),
51 excludeFromAll, preorder, false);
53 // otherwise it is a full path
54 else if ( cmSystemTools::FileIsDirectory(i->c_str()) )
56 // we must compute the binPath from the srcPath, we just take the last
57 // element from the source path and use that
59 std::string(this->Makefile->GetCurrentOutputDirectory()) +
60 "/" + cmSystemTools::GetFilenameName(i->c_str());
61 this->Makefile->AddSubDirectory(i->c_str(), binPath.c_str(),
62 excludeFromAll, preorder, false);
66 std::string error = "Incorrect SUBDIRS command. Directory: ";
67 error += *i + " does not exist.";
68 this->SetError(error.c_str());