FIX: stupid pb fixed (close to being medieval'ed by The Ken)
[cmake.git] / Source / cmAddCustomTargetCommand.cxx
blobdfa560f36cf4d6351b2bc188f339416048db293b
1 /*=========================================================================
3 Program: Insight Segmentation & Registration Toolkit
4 Module: $RCSfile: cmAddCustomTargetCommand.cxx,v $
5 Language: C++
6 Date: $Date: 2002-03-29 19:20:13 $
7 Version: $Revision: 1.9 $
9 Copyright (c) 2002 Insight Consortium. All rights reserved.
10 See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm 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 "cmAddCustomTargetCommand.h"
19 // cmAddCustomTargetCommand
20 bool cmAddCustomTargetCommand::InitialPass(std::vector<std::string> const& argsIn)
22 bool all = false;
24 if(argsIn.size() < 2 )
26 this->SetError("called with incorrect number of arguments");
27 return false;
29 std::vector<std::string> args;
30 cmSystemTools::ExpandListArguments(argsIn, args);
32 // all target option
33 std::string arguments;
34 std::vector<std::string>::const_iterator s = args.begin();
35 ++s; // move past args[0] as it is already to be used
36 if (args.size() >= 3)
38 if (args[1] == "ALL")
40 all = true;
41 ++s; // skip all
44 std::string command;
45 if(s != args.end())
47 command = *s;
48 ++s;
50 for (;s != args.end(); ++s)
52 arguments += cmSystemTools::EscapeSpaces(s->c_str());
53 arguments += " ";
55 m_Makefile->AddUtilityCommand(args[0].c_str(),
56 command.c_str(),
57 arguments.c_str(), all);
59 return true;