BUG: Fix find_* search order with path suffixes
[cmake.git] / Source / cmAddDependenciesCommand.cxx
blob6a375fa84946c91d50608c111f1fad462a7fed41
1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmAddDependenciesCommand.cxx,v $
5 Language: C++
6 Date: $Date: 2008-01-28 13:38:35 $
7 Version: $Revision: 1.17 $
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 "cmAddDependenciesCommand.h"
18 #include "cmLocalGenerator.h"
19 #include "cmGlobalGenerator.h"
21 // cmDependenciesCommand
22 bool cmAddDependenciesCommand
23 ::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
25 if(args.size() < 2 )
27 this->SetError("called with incorrect number of arguments");
28 return false;
31 std::string target_name = args[0];
33 cmTarget* target =
34 this->GetMakefile()->GetLocalGenerator()->
35 GetGlobalGenerator()->FindTarget(0, target_name.c_str());
36 if(target)
38 std::vector<std::string>::const_iterator s = args.begin();
39 ++s; // skip over target_name
40 for (; s != args.end(); ++s)
42 target->AddUtility(s->c_str());
45 else
47 std::string error = "Adding dependency to non-existent target: ";
48 error += target_name;
49 this->SetError(error.c_str());
50 return false;
53 return true;