diff options
author | Marc Chevrier <marc.chevrier@gmail.com> | 2018-09-18 15:23:07 (GMT) |
---|---|---|
committer | Craig Scott <craig.scott@crascit.com> | 2018-09-25 13:59:59 (GMT) |
commit | b5915744ebccd086891f1fab0ae91af54deb3a86 (patch) | |
tree | 6b1e16c11b1be08a33c163cd05966054005e3068 /Source/cmGeneratorTarget.cxx | |
parent | a71caab46b205c2b0367c2b11c12a9b55b09bcca (diff) | |
download | CMake-b5915744ebccd086891f1fab0ae91af54deb3a86.zip CMake-b5915744ebccd086891f1fab0ae91af54deb3a86.tar.gz CMake-b5915744ebccd086891f1fab0ae91af54deb3a86.tar.bz2 |
LINK_DIRECTORIES target property: add policy for absolute paths check.
Diffstat (limited to 'Source/cmGeneratorTarget.cxx')
-rw-r--r-- | Source/cmGeneratorTarget.cxx | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 012d77a..29c6058 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -3091,14 +3091,38 @@ void processLinkDirectories( for (std::string& entryDirectory : entryDirectories) { if (!cmSystemTools::FileIsFullPath(entryDirectory)) { std::ostringstream e; + bool noMessage = false; + cmake::MessageType messageType = cmake::FATAL_ERROR; if (!targetName.empty()) { /* clang-format off */ e << "Target \"" << targetName << "\" contains relative " "path in its INTERFACE_LINK_DIRECTORIES:\n" " \"" << entryDirectory << "\""; /* clang-format on */ - tgt->GetLocalGenerator()->IssueMessage(cmake::FATAL_ERROR, e.str()); - return; + } else { + switch (tgt->GetPolicyStatusCMP0081()) { + case cmPolicies::WARN: { + e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0081) << "\n"; + messageType = cmake::AUTHOR_WARNING; + } break; + case cmPolicies::OLD: + noMessage = true; + break; + case cmPolicies::REQUIRED_IF_USED: + case cmPolicies::REQUIRED_ALWAYS: + case cmPolicies::NEW: + // Issue the fatal message. + break; + } + e << "Found relative path while evaluating link directories of " + "\"" + << tgt->GetName() << "\":\n \"" << entryDirectory << "\"\n"; + } + if (!noMessage) { + tgt->GetLocalGenerator()->IssueMessage(messageType, e.str()); + if (messageType == cmake::FATAL_ERROR) { + return; + } } } |