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 "cmLinkDirectoriesCommand.h"
14 // cmLinkDirectoriesCommand
15 bool cmLinkDirectoriesCommand
16 ::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
23 for(std::vector<std::string>::const_iterator i = args.begin();
31 //----------------------------------------------------------------------------
32 void cmLinkDirectoriesCommand::AddLinkDir(std::string const& dir)
34 std::string unixPath = dir;
35 cmSystemTools::ConvertToUnixSlashes(unixPath);
36 if(!cmSystemTools::FileIsFullPath(unixPath.c_str()))
38 bool convertToAbsolute = false;
40 e << "This command specifies the relative path\n"
41 << " " << unixPath << "\n"
42 << "as a link directory.\n";
43 cmPolicies* policies = this->Makefile->GetPolicies();
44 switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0015))
46 case cmPolicies::WARN:
47 e << policies->GetPolicyWarning(cmPolicies::CMP0015);
48 this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, e.str());
50 // OLD behavior does not convert
52 case cmPolicies::REQUIRED_IF_USED:
53 case cmPolicies::REQUIRED_ALWAYS:
54 e << policies->GetRequiredPolicyError(cmPolicies::CMP0015);
55 this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
57 // NEW behavior converts
58 convertToAbsolute = true;
61 if (convertToAbsolute)
63 std::string tmp = this->Makefile->GetStartDirectory();
69 this->Makefile->AddLinkDirectory(unixPath.c_str());