BUG: Fix find_* search order with path suffixes
[cmake.git] / Source / cmInstallTargetsCommand.cxx
blob4557c5d6bb1041d13e4ce4f750bfbd9795d33709
1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmInstallTargetsCommand.cxx,v $
5 Language: C++
6 Date: $Date: 2008-07-08 15:52:25 $
7 Version: $Revision: 1.16 $
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 "cmInstallTargetsCommand.h"
19 // cmExecutableCommand
20 bool cmInstallTargetsCommand
21 ::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
23 if(args.size() < 2 )
25 this->SetError("called with incorrect number of arguments");
26 return false;
29 // Enable the install target.
30 this->Makefile->GetLocalGenerator()
31 ->GetGlobalGenerator()->EnableInstallTarget();
33 cmTargets &tgts = this->Makefile->GetTargets();
34 std::vector<std::string>::const_iterator s = args.begin();
35 ++s;
36 std::string runtime_dir = "/bin";
37 for (;s != args.end(); ++s)
39 if (*s == "RUNTIME_DIRECTORY")
41 ++s;
42 if ( s == args.end() )
44 this->SetError("called with RUNTIME_DIRECTORY but no actual "
45 "directory");
46 return false;
49 runtime_dir = *s;
51 else if (tgts.find(*s) != tgts.end())
53 tgts[*s].SetInstallPath(args[0].c_str());
54 tgts[*s].SetRuntimeInstallPath(runtime_dir.c_str());
55 tgts[*s].SetHaveInstallRule(true);
57 else
59 std::string str = "Cannot find target: \"" + *s + "\" to install.";
60 this->SetError(str.c_str());
61 return false;
65 this->Makefile->GetLocalGenerator()->GetGlobalGenerator()
66 ->AddInstallComponent("Unspecified");
68 return true;