summaryrefslogtreecommitdiff
path: root/Source/cmTarget.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-11-23 15:00:27 -0500
committerBrad King <brad.king@kitware.com>2020-11-23 15:56:28 -0500
commitf06f4b517cad32ec619774ce8a3a529c3ae32ebd (patch)
treefbb3c1063ac802d79ebc28726f3d1e202241ce04 /Source/cmTarget.cxx
parent43c95df8fb8776d36240e57ffc222587bc2049cd (diff)
downloadcmake-f06f4b517cad32ec619774ce8a3a529c3ae32ebd.tar.gz
cmTarget: Do not enforce CMP0111 on imported INTERFACE libraries
Fix logic added by commit 359c500a24 (cmTarget: Raise error if imported target location is not set, 2020-08-08, v3.19.0-rc1~273^2) to exclude INTERFACE libraries from the policy. They have no location. Fixes: #21470
Diffstat (limited to 'Source/cmTarget.cxx')
-rw-r--r--Source/cmTarget.cxx56
1 files changed, 29 insertions, 27 deletions
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index e076d1e39a..d26de9cd4b 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -2045,35 +2045,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");