Преглед изворни кода

variable_watch: Print accesses as "CMake Debug Log" messages

Use makefile->IssueMessage() to print the unprocessed watch message in a
format consistent with other CMake messages and with a more complete
call stack for the access.
Brad King пре 12 година
родитељ
комит
647745b3ee

+ 3 - 5
Source/cmVariableWatchCommand.cxx

@@ -117,11 +117,9 @@ void cmVariableWatchCommand::VariableAccessed(const std::string& variable,
   if ( !processed )
     {
     cmOStringStream msg;
-    msg << "* Variable \"" << variable.c_str() << "\" was accessed using "
-      << accessString << " in: " << currentListFile << std::endl;
-    msg << "  The value of the variable: \"" << newValue << "\"" << std::endl;
-    msg << "  The list file stack: " << stack.c_str();
-    cmSystemTools::Message(msg.str().c_str());
+    msg << "Variable \"" << variable.c_str() << "\" was accessed using "
+        << accessString << " with value \"" << newValue << "\".";
+    makefile->IssueMessage(cmake::LOG, msg.str());
     }
   this->InCallback = false;
 }

+ 4 - 3
Tests/RunCMake/variable_watch/ModifiedAccess-stderr.txt

@@ -1,3 +1,4 @@
-\* Variable "b" was accessed using MODIFIED_ACCESS in: .*/Tests/RunCMake/variable_watch/ModifiedAccess.cmake
-  The value of the variable: "b"
-  The list file stack: .*/Tests/RunCMake/variable_watch/CMakeLists.txt;.*/Tests/RunCMake/variable_watch/ModifiedAccess.cmake
+CMake Debug Log at ModifiedAccess.cmake:3 \(set\):
+  Variable "b" was accessed using MODIFIED_ACCESS with value "b".
+Call Stack \(most recent call first\):
+  CMakeLists.txt:3 \(include\)$

+ 4 - 3
Tests/RunCMake/variable_watch/NoWatcher-stderr.txt

@@ -1,4 +1,5 @@
 my_func
-\* Variable "b" was accessed using MODIFIED_ACCESS in: .*/Tests/RunCMake/variable_watch/NoWatcher.cmake
-  The value of the variable: ""
-  The list file stack: .*/Tests/RunCMake/variable_watch/CMakeLists.txt;.*/Tests/RunCMake/variable_watch/NoWatcher.cmake$
+CMake Debug Log at NoWatcher.cmake:8 \(set\):
+  Variable "b" was accessed using MODIFIED_ACCESS with value "".
+Call Stack \(most recent call first\):
+  CMakeLists.txt:3 \(include\)$