Resync
[CMakeLuaTailorHgBridge.git] / CMakeLua / Source / cmInstallTargetsCommand.cxx
blob0da066e31e1d9619bcd26580e3b2cfc5e6058869
1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmInstallTargetsCommand.cxx,v $
5 Language: C++
6 <<<<<<< cmInstallTargetsCommand.cxx
7 Date: $Date: 2008/01/23 15:27:59 $
8 Version: $Revision: 1.15 $
9 =======
10 Date: $Date: 2008-07-08 15:52:25 $
11 Version: $Revision: 1.16 $
12 >>>>>>> 1.16
14 Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
15 See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
17 This software is distributed WITHOUT ANY WARRANTY; without even
18 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
19 PURPOSE. See the above copyright notices for more information.
21 =========================================================================*/
22 #include "cmInstallTargetsCommand.h"
24 // cmExecutableCommand
25 bool cmInstallTargetsCommand
26 ::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
28 if(args.size() < 2 )
30 this->SetError("called with incorrect number of arguments");
31 return false;
34 // Enable the install target.
35 this->Makefile->GetLocalGenerator()
36 ->GetGlobalGenerator()->EnableInstallTarget();
38 cmTargets &tgts = this->Makefile->GetTargets();
39 std::vector<std::string>::const_iterator s = args.begin();
40 ++s;
41 std::string runtime_dir = "/bin";
42 for (;s != args.end(); ++s)
44 if (*s == "RUNTIME_DIRECTORY")
46 ++s;
47 if ( s == args.end() )
49 this->SetError("called with RUNTIME_DIRECTORY but no actual "
50 "directory");
51 return false;
54 runtime_dir = *s;
56 else if (tgts.find(*s) != tgts.end())
58 tgts[*s].SetInstallPath(args[0].c_str());
59 tgts[*s].SetRuntimeInstallPath(runtime_dir.c_str());
60 tgts[*s].SetHaveInstallRule(true);
62 else
64 std::string str = "Cannot find target: \"" + *s + "\" to install.";
65 this->SetError(str.c_str());
66 return false;
70 this->Makefile->GetLocalGenerator()->GetGlobalGenerator()
71 ->AddInstallComponent("Unspecified");
73 return true;