ENH: change the search path order (if several Tcl/Tk are installed, the "current...
[cmake.git] / Source / cmInstallProgramsCommand.cxx
bloba2d5b7d22c7bb9556185e465ffdaa2f61f18d089
1 /*=========================================================================
3 Program: Insight Segmentation & Registration Toolkit
4 Module: $RCSfile: cmInstallProgramsCommand.cxx,v $
5 Language: C++
6 Date: $Date: 2002-03-29 19:20:20 $
7 Version: $Revision: 1.6 $
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 "cmInstallProgramsCommand.h"
18 #include "cmCacheManager.h"
20 // cmExecutableCommand
21 bool cmInstallProgramsCommand::InitialPass(std::vector<std::string> const& argsIn)
23 if(argsIn.size() < 2)
25 this->SetError("called with incorrect number of arguments");
26 return false;
28 std::vector<std::string> args;
29 cmSystemTools::ExpandListArguments(argsIn, args);
31 // Create an INSTALL_PROGRAMS target specifically for this path.
32 m_TargetName = "INSTALL_PROGRAMS_"+args[0];
33 cmTarget target;
34 target.SetInAll(false);
35 target.SetType(cmTarget::INSTALL_PROGRAMS);
36 target.SetInstallPath(args[0].c_str());
37 m_Makefile->GetTargets().insert(cmTargets::value_type(m_TargetName, target));
39 std::vector<std::string>::const_iterator s = args.begin();
40 for (++s;s != args.end(); ++s)
42 m_FinalArgs.push_back(*s);
45 return true;
48 void cmInstallProgramsCommand::FinalPass()
50 std::vector<std::string>& targetSourceLists =
51 m_Makefile->GetTargets()[m_TargetName].GetSourceLists();
53 // two different options
54 if (m_FinalArgs.size() > 1)
56 // for each argument, get the programs
57 for (std::vector<std::string>::iterator s = m_FinalArgs.begin();
58 s != m_FinalArgs.end(); ++s)
60 // add to the result
61 targetSourceLists.push_back(*s);
64 else // reg exp list
66 std::vector<std::string> programs;
67 cmSystemTools::Glob(m_Makefile->GetCurrentDirectory(),
68 m_FinalArgs[0].c_str(), programs);
70 std::vector<std::string>::iterator s = programs.begin();
71 // for each argument, get the programs
72 for (;s != programs.end(); ++s)
74 targetSourceLists.push_back(*s);