diff options
author | Brad King <brad.king@kitware.com> | 2020-11-24 13:43:10 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2020-11-24 13:43:22 (GMT) |
commit | adf3ea701d67a347db98d5ac5daf496226024a6a (patch) | |
tree | eec01b039261a9d2aabaf01a68fb2f0027a23b43 /Source/cmTarget.cxx | |
parent | db6b10b2197e1a001763448611e6df88df712f6b (diff) | |
parent | 54ef732b0c409b3ed9376bf6cdb40d1038209ecb (diff) | |
download | CMake-adf3ea701d67a347db98d5ac5daf496226024a6a.zip CMake-adf3ea701d67a347db98d5ac5daf496226024a6a.tar.gz CMake-adf3ea701d67a347db98d5ac5daf496226024a6a.tar.bz2 |
Merge topic 'policy-cmp0111-iface'
54ef732b0c cmVisualStudio10TargetGenerator: Avoid GetFullPath on INTERFACE library
f06f4b517c cmTarget: Do not enforce CMP0111 on imported INTERFACE libraries
43c95df8fb Tests: Match RunCMake.CMP0111 stderr more strictly
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5530
Diffstat (limited to 'Source/cmTarget.cxx')
-rw-r--r-- | Source/cmTarget.cxx | 56 |
1 files changed, 29 insertions, 27 deletions
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 35224eb..9db5dc6 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -2053,35 +2053,37 @@ std::string cmTarget::ImportedGetFullPath( } if (result.empty()) { - auto message = [&]() -> std::string { - std::string unset; - std::string configuration; - - if (artifact == cmStateEnums::RuntimeBinaryArtifact) { - unset = "IMPORTED_LOCATION"; - } else if (artifact == cmStateEnums::ImportLibraryArtifact) { - unset = "IMPORTED_IMPLIB"; - } - - if (!config.empty()) { - configuration = cmStrCat(" configuration \"", config, "\""); - } + if (this->GetType() != cmStateEnums::INTERFACE_LIBRARY) { + auto message = [&]() -> std::string { + std::string unset; + std::string configuration; + + if (artifact == cmStateEnums::RuntimeBinaryArtifact) { + unset = "IMPORTED_LOCATION"; + } else if (artifact == cmStateEnums::ImportLibraryArtifact) { + unset = "IMPORTED_IMPLIB"; + } - return cmStrCat(unset, " not set for imported target \"", - this->GetName(), "\"", configuration, "."); - }; + if (!config.empty()) { + configuration = cmStrCat(" configuration \"", config, "\""); + } - switch (this->GetPolicyStatus(cmPolicies::CMP0111)) { - case cmPolicies::WARN: - impl->Makefile->IssueMessage( - MessageType::AUTHOR_WARNING, - cmPolicies::GetPolicyWarning(cmPolicies::CMP0111) + "\n" + - message()); - CM_FALLTHROUGH; - case cmPolicies::OLD: - break; - default: - impl->Makefile->IssueMessage(MessageType::FATAL_ERROR, message()); + return cmStrCat(unset, " not set for imported target \"", + this->GetName(), "\"", configuration, "."); + }; + + switch (this->GetPolicyStatus(cmPolicies::CMP0111)) { + case cmPolicies::WARN: + impl->Makefile->IssueMessage( + MessageType::AUTHOR_WARNING, + cmPolicies::GetPolicyWarning(cmPolicies::CMP0111) + "\n" + + message()); + CM_FALLTHROUGH; + case cmPolicies::OLD: + break; + default: + impl->Makefile->IssueMessage(MessageType::FATAL_ERROR, message()); + } } result = cmStrCat(this->GetName(), "-NOTFOUND"); |