mirror of
https://gitlab.kitware.com/cmake/cmake.git
synced 2026-09-25 04:09:36 +03:00
Add and use a couple helper functions for issuing policy warnings. This improves consistency and allows some simplification of many call sites. (One or two instances in particular are greatly simplified.)
44 lines
1.1 KiB
C++
44 lines
1.1 KiB
C++
/* 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);
|
|
}
|
|
}
|