1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmSubdirCommand.cxx,v $
6 Date: $Date: 2008-01-23 15:27:59 $
7 Version: $Revision: 1.19 $
9 Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
10 See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
12 This software is distributed WITHOUT ANY WARRANTY; without even
13 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 PURPOSE. See the above copyright notices for more information.
16 =========================================================================*/
17 #include "cmSubdirCommand.h"
21 ::InitialPass(std::vector
<std::string
> const& args
, cmExecutionStatus
&)
25 this->SetError("called with incorrect number of arguments");
29 bool excludeFromAll
= false;
30 bool preorder
= false;
32 for(std::vector
<std::string
>::const_iterator i
= args
.begin();
35 if(*i
== "EXCLUDE_FROM_ALL")
37 excludeFromAll
= true;
46 // if they specified a relative path then compute the full
48 std::string(this->Makefile
->GetCurrentDirectory()) +
50 if (cmSystemTools::FileIsDirectory(srcPath
.c_str()))
53 std::string(this->Makefile
->GetCurrentOutputDirectory()) +
55 this->Makefile
->AddSubDirectory(srcPath
.c_str(), binPath
.c_str(),
56 excludeFromAll
, preorder
, false);
58 // otherwise it is a full path
59 else if ( cmSystemTools::FileIsDirectory(i
->c_str()) )
61 // we must compute the binPath from the srcPath, we just take the last
62 // element from the source path and use that
64 std::string(this->Makefile
->GetCurrentOutputDirectory()) +
65 "/" + cmSystemTools::GetFilenameName(i
->c_str());
66 this->Makefile
->AddSubDirectory(i
->c_str(), binPath
.c_str(),
67 excludeFromAll
, preorder
, false);
71 std::string error
= "Incorrect SUBDIRS command. Directory: ";
72 error
+= *i
+ " does not exists.";
73 this->SetError(error
.c_str());