mirror of
https://github.com/Kitware/CMake.git
synced 2025-06-15 16:39:26 +08:00

Previously we disallowed use of arbitrary properties on INTERFACE libraries. The goal was to future-proof projects using them by not allowing properties to be set that may affect their future inclusion in the generated buildsystem. In order to prepare to actually include INTERFACE libraries in the generated buildsystem, drop the filter and allow arbitrary properties to be set. Issue: #19145
44 lines
1.3 KiB
C++
44 lines
1.3 KiB
C++
/* 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>
|
|
|
|
#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::ostringstream e;
|
|
const char* modal = nullptr;
|
|
MessageType messageType = MessageType::AUTHOR_WARNING;
|
|
switch (context.GetBottom().GetPolicy(cmPolicies::CMP0026)) {
|
|
case cmPolicies::WARN:
|
|
e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0026) << "\n";
|
|
modal = "should";
|
|
case cmPolicies::OLD:
|
|
break;
|
|
case cmPolicies::REQUIRED_ALWAYS:
|
|
case cmPolicies::REQUIRED_IF_USED:
|
|
case cmPolicies::NEW:
|
|
modal = "may";
|
|
messageType = MessageType::FATAL_ERROR;
|
|
}
|
|
|
|
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";
|
|
messenger->IssueMessage(messageType, e.str(), context);
|
|
}
|
|
|
|
return messageType != MessageType::FATAL_ERROR;
|
|
}
|