blob: 836c6ca858c458e6802d2eb3c05dae103a5e8f66 [file] [edit]
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file LICENSE.rst or https://cmake.org/licensing for details. */
#include "cmBinUtilsLinker.h"
#include <utility>
#include "cmCMakePath.h"
#include "cmMakefile.h"
#include "cmPolicies.h"
#include "cmRuntimeDependencyArchive.h"
#include "cmStringAlgorithms.h"
cmBinUtilsLinker::cmBinUtilsLinker(cmRuntimeDependencyArchive* archive)
: Archive(archive)
{
}
void cmBinUtilsLinker::SetError(std::string const& e)
{
this->Archive->SetError(e);
}
void cmBinUtilsLinker::NormalizePath(std::string& path) const
{
std::string normalizedPath =
cmCMakePath(path, cmCMakePath::auto_format).GenericString();
if (path == normalizedPath) {
return;
}
cmPolicies::PolicyStatus policy =
this->Archive->GetMakefile()->GetPolicyStatus(cmPolicies::CMP0207);
if (policy == cmPolicies::WARN) {
this->Archive->GetMakefile()->IssuePolicyWarning(
cmPolicies::CMP0207, {},
cmStrCat("Path\n \"", path, "\"\nwould be converted to\n \"",
normalizedPath, "\"\n"));
} else if (policy == cmPolicies::NEW) {
path = std::move(normalizedPath);
}
}