cmake/Source/cmLinkDirectoriesCommand.cxx

70 lines
2.2 KiB
C++
Raw Normal View History

2009-10-04 10:30:41 +03:00
/*============================================================================
CMake - Cross Platform Makefile Generator
Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
2009-10-04 10:30:41 +03:00
Distributed under the OSI-approved BSD License (the "License");
see accompanying file Copyright.txt for details.
2009-10-04 10:30:41 +03:00
This software is distributed WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License for more information.
============================================================================*/
#include "cmLinkDirectoriesCommand.h"
// cmLinkDirectoriesCommand
bool cmLinkDirectoriesCommand
::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
{
if(args.size() < 1 )
{
return true;
}
for(std::vector<std::string>::const_iterator i = args.begin();
i != args.end(); ++i)
{
2010-03-17 14:00:29 +02:00
this->AddLinkDir(*i);
}
return true;
}
2010-03-17 14:00:29 +02:00
//----------------------------------------------------------------------------
void cmLinkDirectoriesCommand::AddLinkDir(std::string const& dir)
{
std::string unixPath = dir;
cmSystemTools::ConvertToUnixSlashes(unixPath);
if(!cmSystemTools::FileIsFullPath(unixPath.c_str()))
{
bool convertToAbsolute = false;
2015-04-27 22:25:09 +02:00
std::ostringstream e;
2010-03-17 14:00:29 +02:00
e << "This command specifies the relative path\n"
<< " " << unixPath << "\n"
<< "as a link directory.\n";
switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0015))
{
case cmPolicies::WARN:
2015-08-17 11:37:30 +02:00
e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0015);
2010-03-17 14:00:29 +02:00
this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, e.str());
case cmPolicies::OLD:
// OLD behavior does not convert
break;
case cmPolicies::REQUIRED_IF_USED:
case cmPolicies::REQUIRED_ALWAYS:
2015-08-17 11:37:30 +02:00
e << cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0015);
2010-03-17 14:00:29 +02:00
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
case cmPolicies::NEW:
// NEW behavior converts
convertToAbsolute = true;
break;
}
if (convertToAbsolute)
{
2015-08-17 11:37:30 +02:00
std::string tmp = this->Makefile->GetCurrentSourceDirectory();
2010-03-17 14:00:29 +02:00
tmp += "/";
tmp += unixPath;
unixPath = tmp;
}
}
2015-04-27 22:25:09 +02:00
this->Makefile->AddLinkDirectory(unixPath);
2010-03-17 14:00:29 +02:00
}