summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2013-11-03 11:45:21 (GMT)
committerBrad King <brad.king@kitware.com>2013-11-03 14:14:54 (GMT)
commit0a561a03475f4ed1e017802970a8f17998fe05c3 (patch)
treeaab30abe815bc222e1bd8ded999c5229d3dd0e77 /Source
parent23d21b78e125c11a0d901eb987e5f616026ff8fd (diff)
downloadCMake-0a561a03475f4ed1e017802970a8f17998fe05c3.zip
CMake-0a561a03475f4ed1e017802970a8f17998fe05c3.tar.gz
CMake-0a561a03475f4ed1e017802970a8f17998fe05c3.tar.bz2
CMP0022: Warn about a given target at most once
Since cmTarget::ComputeLinkInterface is called separately for each "head" target that links a target, the warning we produce when CMP0022 is not set could be repeated. Add explicit logic to allow the warning to appear at most once. Multiple copies of the warning for the same target are almost always identical and therefore redundant. In the rare case that two copies of the warning are different, the second can appear in a future run after the first is fixed.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmTarget.cxx11
1 files changed, 9 insertions, 2 deletions
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 3365caf..3598fcc 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -83,10 +83,12 @@ class cmTargetInternals
public:
cmTargetInternals()
{
+ this->PolicyWarnedCMP0022 = false;
this->SourceFileFlagsConstructed = false;
}
cmTargetInternals(cmTargetInternals const& r)
{
+ this->PolicyWarnedCMP0022 = false;
this->SourceFileFlagsConstructed = false;
// Only some of these entries are part of the object state.
// Others not copied here are result caches.
@@ -109,6 +111,7 @@ public:
typedef std::map<TargetConfigPair, OptionalLinkInterface>
LinkInterfaceMapType;
LinkInterfaceMapType LinkInterfaceMap;
+ bool PolicyWarnedCMP0022;
typedef std::map<cmStdString, cmTarget::OutputInfo> OutputInfoMapType;
OutputInfoMapType OutputInfoMap;
@@ -6433,7 +6436,8 @@ bool cmTarget::ComputeLinkInterface(const char* config, LinkInterface& iface,
}
}
- if(explicitLibraries && this->PolicyStatusCMP0022 == cmPolicies::WARN)
+ if(explicitLibraries && this->PolicyStatusCMP0022 == cmPolicies::WARN &&
+ !this->Internal->PolicyWarnedCMP0022)
{
// Compare the explicitly set old link interface properties to the
// preferred new link interface property one and warn if different.
@@ -6455,6 +6459,7 @@ bool cmTarget::ComputeLinkInterface(const char* config, LinkInterface& iface,
linkIfaceProp << ":\n"
" " << (explicitLibraries ? explicitLibraries : "(empty)") << "\n";
this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, w.str());
+ this->Internal->PolicyWarnedCMP0022 = true;
}
}
@@ -6544,7 +6549,8 @@ bool cmTarget::ComputeLinkInterface(const char* config, LinkInterface& iface,
iface.Languages = impl->Languages;
}
- if(this->PolicyStatusCMP0022 == cmPolicies::WARN)
+ if(this->PolicyStatusCMP0022 == cmPolicies::WARN &&
+ !this->Internal->PolicyWarnedCMP0022)
{
// Compare the link implementation fallback link interface to the
// preferred new link interface property and warn if different.
@@ -6603,6 +6609,7 @@ bool cmTarget::ComputeLinkInterface(const char* config, LinkInterface& iface,
"Link implementation:\n"
" " << oldLibraries << "\n";
this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, w.str());
+ this->Internal->PolicyWarnedCMP0022 = true;
}
}
}