cmake/Source/cmTargetPropertyComputer.cxx

44 lines
1.3 KiB
C++
Raw Normal View History

2017-04-14 19:02:05 +02:00
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmTargetPropertyComputer.h"
#include <sstream>
2022-03-29 21:10:50 +02:00
#include "cmMakefile.h"
2019-11-11 23:01:05 +01:00
#include "cmMessageType.h"
2017-04-14 19:02:05 +02:00
#include "cmPolicies.h"
bool cmTargetPropertyComputer::HandleLocationPropertyPolicy(
2022-03-29 21:10:50 +02:00
std::string const& tgtName, cmMakefile const& mf)
2017-04-14 19:02:05 +02:00
{
std::ostringstream e;
2018-01-26 17:06:56 +01:00
const char* modal = nullptr;
2019-11-11 23:01:05 +01:00
MessageType messageType = MessageType::AUTHOR_WARNING;
2022-03-29 21:10:50 +02:00
switch (mf.GetPolicyStatus(cmPolicies::CMP0026)) {
2017-04-14 19:02:05 +02:00
case cmPolicies::WARN:
e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0026) << "\n";
modal = "should";
2021-11-20 13:41:27 +01:00
CM_FALLTHROUGH;
2017-04-14 19:02:05 +02:00
case cmPolicies::OLD:
break;
case cmPolicies::REQUIRED_ALWAYS:
case cmPolicies::REQUIRED_IF_USED:
case cmPolicies::NEW:
modal = "may";
2019-11-11 23:01:05 +01:00
messageType = MessageType::FATAL_ERROR;
2021-11-20 13:41:27 +01:00
break;
2017-04-14 19:02:05 +02:00
}
if (modal) {
e << "The LOCATION property " << modal << " not be read from target \""
<< tgtName
<< "\". Use the target name directly with "
"add_custom_command, or use the generator expression $<TARGET_FILE>, "
"as appropriate.\n";
2022-03-29 21:10:50 +02:00
mf.IssueMessage(messageType, e.str());
2017-04-14 19:02:05 +02:00
}
2019-11-11 23:01:05 +01:00
return messageType != MessageType::FATAL_ERROR;
2017-04-14 19:02:05 +02:00
}