1 /*============================================================================
2 CMake - Cross Platform Makefile Generator
3 Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
5 Distributed under the OSI-approved BSD License (the "License");
6 see accompanying file Copyright.txt for details.
8 This software is distributed WITHOUT ANY WARRANTY; without even the
9 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 See the License for more information.
11 ============================================================================*/
12 #include "cmInstallTargetsCommand.h"
14 // cmExecutableCommand
15 bool cmInstallTargetsCommand
16 ::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
20 this->SetError("called with incorrect number of arguments");
24 // Enable the install target.
25 this->Makefile->GetLocalGenerator()
26 ->GetGlobalGenerator()->EnableInstallTarget();
28 cmTargets &tgts = this->Makefile->GetTargets();
29 std::vector<std::string>::const_iterator s = args.begin();
31 std::string runtime_dir = "/bin";
32 for (;s != args.end(); ++s)
34 if (*s == "RUNTIME_DIRECTORY")
37 if ( s == args.end() )
39 this->SetError("called with RUNTIME_DIRECTORY but no actual "
46 else if (tgts.find(*s) != tgts.end())
48 tgts[*s].SetInstallPath(args[0].c_str());
49 tgts[*s].SetRuntimeInstallPath(runtime_dir.c_str());
50 tgts[*s].SetHaveInstallRule(true);
54 std::string str = "Cannot find target: \"" + *s + "\" to install.";
55 this->SetError(str.c_str());
60 this->Makefile->GetLocalGenerator()->GetGlobalGenerator()
61 ->AddInstallComponent(this->Makefile->GetSafeDefinition(
62 "CMAKE_INSTALL_DEFAULT_COMPONENT_NAME"));