CMake Nightly Date Stamp
[kiteware-cmake.git] / Source / cmTargetPropertyComputer.cxx
blob134b4b610e49dee49236f0adf647a0a7f7ee4b59
1 /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
2 file Copyright.txt or https://cmake.org/licensing for details. */
4 #include "cmTargetPropertyComputer.h"
6 #include <sstream>
8 #include "cmMakefile.h"
9 #include "cmMessageType.h"
10 #include "cmPolicies.h"
12 bool cmTargetPropertyComputer::HandleLocationPropertyPolicy(
13 std::string const& tgtName, cmMakefile const& mf)
15 std::ostringstream e;
16 const char* modal = nullptr;
17 MessageType messageType = MessageType::AUTHOR_WARNING;
18 switch (mf.GetPolicyStatus(cmPolicies::CMP0026)) {
19 case cmPolicies::WARN:
20 e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0026) << "\n";
21 modal = "should";
22 CM_FALLTHROUGH;
23 case cmPolicies::OLD:
24 break;
25 case cmPolicies::REQUIRED_ALWAYS:
26 case cmPolicies::REQUIRED_IF_USED:
27 case cmPolicies::NEW:
28 modal = "may";
29 messageType = MessageType::FATAL_ERROR;
30 break;
33 if (modal) {
34 e << "The LOCATION property " << modal << " not be read from target \""
35 << tgtName
36 << "\". Use the target name directly with "
37 "add_custom_command, or use the generator expression $<TARGET_FILE>, "
38 "as appropriate.\n";
39 mf.IssueMessage(messageType, e.str());
42 return messageType != MessageType::FATAL_ERROR;