mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-21 23:38:33 -05:00
cmTargetPropertyComputer: Simplify by restoring use of cmMakefile
Logically revert commit 390a7d8647 (cmTargetPropertyComputer: Implement
GetProperty without cmMakefile, 2016-10-13, v3.8.0-rc1~445^2~9).
It relied on using `cmListFileBacktrace` to get a scope in which to
look up policies.
This does remove a backtrace from `LOCATION` property errors at generate
time, but the backtrace we reported before was incorrect. It pointed at
the addition of a target, not to the reference to the property.
This commit is contained in:
@@ -5,19 +5,17 @@
|
||||
|
||||
#include <sstream>
|
||||
|
||||
#include "cmMakefile.h"
|
||||
#include "cmMessageType.h"
|
||||
#include "cmMessenger.h"
|
||||
#include "cmPolicies.h"
|
||||
#include "cmStateSnapshot.h"
|
||||
|
||||
bool cmTargetPropertyComputer::HandleLocationPropertyPolicy(
|
||||
std::string const& tgtName, cmMessenger* messenger,
|
||||
cmListFileBacktrace const& context)
|
||||
std::string const& tgtName, cmMakefile const& mf)
|
||||
{
|
||||
std::ostringstream e;
|
||||
const char* modal = nullptr;
|
||||
MessageType messageType = MessageType::AUTHOR_WARNING;
|
||||
switch (context.GetBottom().GetPolicy(cmPolicies::CMP0026)) {
|
||||
switch (mf.GetPolicyStatus(cmPolicies::CMP0026)) {
|
||||
case cmPolicies::WARN:
|
||||
e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0026) << "\n";
|
||||
modal = "should";
|
||||
@@ -38,7 +36,7 @@ bool cmTargetPropertyComputer::HandleLocationPropertyPolicy(
|
||||
<< "\". Use the target name directly with "
|
||||
"add_custom_command, or use the generator expression $<TARGET_FILE>, "
|
||||
"as appropriate.\n";
|
||||
messenger->IssueMessage(messageType, e.str(), context);
|
||||
mf.IssueMessage(messageType, e.str());
|
||||
}
|
||||
|
||||
return messageType != MessageType::FATAL_ERROR;
|
||||
|
||||
Reference in New Issue
Block a user