summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/cmMessageCommand.cxx3
-rw-r--r--Source/cmake.cxx25
-rw-r--r--Source/cmake.h6
-rw-r--r--Tests/RunCMake/CommandLine/RunCMakeTest.cmake3
-rw-r--r--Tests/RunCMake/message/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/message/defaultmessage-result.txt1
-rw-r--r--Tests/RunCMake/message/defaultmessage-stderr.txt5
-rw-r--r--Tests/RunCMake/message/defaultmessage.cmake4
8 files changed, 42 insertions, 6 deletions
diff --git a/Source/cmMessageCommand.cxx b/Source/cmMessageCommand.cxx
index 1c65ef7..fd0345d 100644
--- a/Source/cmMessageCommand.cxx
+++ b/Source/cmMessageCommand.cxx
@@ -43,7 +43,8 @@ bool cmMessageCommand
}
else if (*i == "AUTHOR_WARNING")
{
- if (this->Makefile->IsOn("CMAKE_SUPPRESS_DEVELOPER_WARNINGS"))
+ if (this->Makefile->GetCMakeInstance()->GetSuppressDevWarnings(
+ this->Makefile))
{
return true;
}
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 62476a1..5213130 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -1580,6 +1580,7 @@ int cmake::Run(const std::vector<std::string>& args, bool noconfigure)
{
this->AddCMakePaths();
}
+
// Add any cache args
if ( !this->SetCacheArgs(args) )
{
@@ -2511,11 +2512,7 @@ bool cmake::IsMessageTypeVisible(cmake::MessageType t)
}
else if (t == cmake::AUTHOR_WARNING)
{
- // if CMAKE_SUPPRESS_DEVELOPER_WARNINGS is on, suppress the message,
- // otherwise show it
- const char* suppressDevWarnings = this->State->GetCacheEntryValue(
- "CMAKE_SUPPRESS_DEVELOPER_WARNINGS");
- if(cmSystemTools::IsOn(suppressDevWarnings))
+ if (this->GetSuppressDevWarnings())
{
isVisible = false;
}
@@ -2807,3 +2804,21 @@ void cmake::RunCheckForUnusedVariables()
}
#endif
}
+
+bool cmake::GetSuppressDevWarnings(cmMakefile const* mf)
+{
+ /*
+ * The suppression CMake variable may be set in the CMake configuration file
+ * itself, so we have to check what its set to in the makefile if we can.
+ */
+ if (mf)
+ {
+ return mf->IsOn("CMAKE_SUPPRESS_DEVELOPER_WARNINGS");
+ }
+ else
+ {
+ const char* cacheEntryValue = this->State->GetCacheEntryValue(
+ "CMAKE_SUPPRESS_DEVELOPER_WARNINGS");
+ return cmSystemTools::IsOn(cacheEntryValue);
+ }
+}
diff --git a/Source/cmake.h b/Source/cmake.h
index 0630daa..45ac28e 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -308,6 +308,12 @@ class cmake
this->SuppressDevWarnings = v;
this->DoSuppressDevWarnings = true;
}
+ /*
+ * Get the state of the suppression of developer (author) warnings.
+ * Returns false, by default, if developer warnings should be shown, true
+ * otherwise.
+ */
+ bool GetSuppressDevWarnings(cmMakefile const* mf = NULL);
/** Display a message to the user. */
void IssueMessage(cmake::MessageType t, std::string const& text,
diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
index 2d94e29..8eaaa08 100644
--- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
@@ -133,6 +133,9 @@ set(RunCMake_TEST_OPTIONS -Wno-dev -Wdev)
run_cmake(Wdev)
unset(RunCMake_TEST_OPTIONS)
+# Dev warnings should be on by default
+run_cmake(Wdev)
+
set(RunCMake_TEST_OPTIONS --debug-output)
run_cmake(debug-output)
unset(RunCMake_TEST_OPTIONS)
diff --git a/Tests/RunCMake/message/RunCMakeTest.cmake b/Tests/RunCMake/message/RunCMakeTest.cmake
index d2bc0c3..294dfbb 100644
--- a/Tests/RunCMake/message/RunCMakeTest.cmake
+++ b/Tests/RunCMake/message/RunCMakeTest.cmake
@@ -1,5 +1,6 @@
include(RunCMake)
+run_cmake(defaultmessage)
run_cmake(nomessage)
run_cmake(warnmessage)
run_cmake(errormessage)
diff --git a/Tests/RunCMake/message/defaultmessage-result.txt b/Tests/RunCMake/message/defaultmessage-result.txt
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/Tests/RunCMake/message/defaultmessage-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/message/defaultmessage-stderr.txt b/Tests/RunCMake/message/defaultmessage-stderr.txt
new file mode 100644
index 0000000..95656ec
--- /dev/null
+++ b/Tests/RunCMake/message/defaultmessage-stderr.txt
@@ -0,0 +1,5 @@
+^CMake Warning \(dev\) at defaultmessage.cmake:4 \(message\):
+ This is a author warning
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.$
diff --git a/Tests/RunCMake/message/defaultmessage.cmake b/Tests/RunCMake/message/defaultmessage.cmake
new file mode 100644
index 0000000..427014d
--- /dev/null
+++ b/Tests/RunCMake/message/defaultmessage.cmake
@@ -0,0 +1,4 @@
+
+message(DEPRECATION "This is a deprecation warning")
+
+message(AUTHOR_WARNING "This is a author warning")