summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/cmGlobalGenerator.cxx6
-rw-r--r--Source/cmMakefile.cxx16
-rw-r--r--Source/cmMakefile.h2
3 files changed, 22 insertions, 2 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 4f3328d..beb10da 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -759,7 +759,8 @@ void cmGlobalGenerator::CheckCompilerIdCompatibility(cmMakefile* mf,
switch(mf->GetPolicyStatus(cmPolicies::CMP0025))
{
case cmPolicies::WARN:
- if(!this->CMakeInstance->GetIsInTryCompile())
+ if(!this->CMakeInstance->GetIsInTryCompile() &&
+ mf->PolicyOptionalWarningEnabled("CMAKE_POLICY_WARNING_CMP0025"))
{
cmOStringStream w;
w << policies->GetPolicyWarning(cmPolicies::CMP0025) << "\n"
@@ -790,7 +791,8 @@ void cmGlobalGenerator::CheckCompilerIdCompatibility(cmMakefile* mf,
switch(mf->GetPolicyStatus(cmPolicies::CMP0047))
{
case cmPolicies::WARN:
- if(!this->CMakeInstance->GetIsInTryCompile())
+ if(!this->CMakeInstance->GetIsInTryCompile() &&
+ mf->PolicyOptionalWarningEnabled("CMAKE_POLICY_WARNING_CMP0047"))
{
cmOStringStream w;
w << policies->GetPolicyWarning(cmPolicies::CMP0047) << "\n"
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 10137ec..b195943 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -4350,6 +4350,22 @@ cmMakefile::GetPolicyStatusInternal(cmPolicies::PolicyID id) const
return this->GetPolicies()->GetPolicyStatus(id);
}
+//----------------------------------------------------------------------------
+bool cmMakefile::PolicyOptionalWarningEnabled(std::string const& var)
+{
+ // Check for an explicit CMAKE_POLICY_WARNING_CMP<NNNN> setting.
+ if(!var.empty())
+ {
+ if(const char* val = this->GetDefinition(var.c_str()))
+ {
+ return cmSystemTools::IsOn(val);
+ }
+ }
+ // Enable optional policy warnings with --debug-output or --trace.
+ cmake* cm = this->GetCMakeInstance();
+ return cm->GetDebugOutput() || cm->GetTrace();
+}
+
bool cmMakefile::SetPolicy(const char *id,
cmPolicies::PolicyStatus status)
{
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 45f3b9f..f00fd20 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -875,6 +875,8 @@ public:
std::set<cmStdString> const & GetSystemIncludeDirectories() const
{ return this->SystemIncludeDirectories; }
+ bool PolicyOptionalWarningEnabled(std::string const& var);
+
protected:
// add link libraries and directories to the target
void AddGlobalLinkInformation(const char* name, cmTarget& target);