summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2013-06-04 13:03:00 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2013-06-04 13:03:00 (GMT)
commitd3971ee603d5de51e7a15c816be137324d860124 (patch)
tree8a789c11f303ce881a41085c519a862ea89e52d3
parent1e15db366218170bca663c06f0246782c2642bdb (diff)
parent647745b3eedd0036d9e745007acd1d9cc460ccab (diff)
downloadCMake-d3971ee603d5de51e7a15c816be137324d860124.zip
CMake-d3971ee603d5de51e7a15c816be137324d860124.tar.gz
CMake-d3971ee603d5de51e7a15c816be137324d860124.tar.bz2
Merge topic 'fix-variable_watch-cases'
647745b variable_watch: Print accesses as "CMake Debug Log" messages 515f9af variable_watch: Remove leftover debugging code (#14187) c63d300 variable_watch: Add test for MODIFIED_ACCESS report 3d5bb38 variable_watch: Add missing string enumeration entry (#14188)
-rw-r--r--Source/cmVariableWatch.cxx1
-rw-r--r--Source/cmVariableWatchCommand.cxx21
-rw-r--r--Tests/RunCMake/CMakeLists.txt1
-rw-r--r--Tests/RunCMake/variable_watch/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/variable_watch/ModifiedAccess-stderr.txt4
-rw-r--r--Tests/RunCMake/variable_watch/ModifiedAccess.cmake3
-rw-r--r--Tests/RunCMake/variable_watch/NoWatcher-stderr.txt5
-rw-r--r--Tests/RunCMake/variable_watch/NoWatcher.cmake8
-rw-r--r--Tests/RunCMake/variable_watch/RunCMakeTest.cmake4
9 files changed, 32 insertions, 18 deletions
diff --git a/Source/cmVariableWatch.cxx b/Source/cmVariableWatch.cxx
index f5fdca4..3905e9b 100644
--- a/Source/cmVariableWatch.cxx
+++ b/Source/cmVariableWatch.cxx
@@ -15,6 +15,7 @@ static const char* const cmVariableWatchAccessStrings[] =
{
"READ_ACCESS",
"UNKNOWN_READ_ACCESS",
+ "UNKNOWN_DEFINED_ACCESS",
"ALLOWED_UNKNOWN_READ_ACCESS",
"MODIFIED_ACCESS",
"REMOVED_ACCESS",
diff --git a/Source/cmVariableWatchCommand.cxx b/Source/cmVariableWatchCommand.cxx
index a432943..297a92b 100644
--- a/Source/cmVariableWatchCommand.cxx
+++ b/Source/cmVariableWatchCommand.cxx
@@ -117,24 +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());
- std::vector<std::string> vars = makefile->GetDefinitions();
- cmOStringStream msg2;
- size_t cc;
- for ( cc = 0; cc < vars.size(); cc ++ )
- {
- if ( vars[cc] == variable )
- {
- continue;
- }
- msg2 << vars[cc] << " = \""
- << makefile->GetDefinition(vars[cc].c_str()) << "\"" << std::endl;
- }
- //cmSystemTools::Message(msg2.str().c_str());
+ msg << "Variable \"" << variable.c_str() << "\" was accessed using "
+ << accessString << " with value \"" << newValue << "\".";
+ makefile->IssueMessage(cmake::LOG, msg.str());
}
this->InCallback = false;
}
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index f1e01b1..86c9725 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -77,6 +77,7 @@ add_RunCMake_test(include)
add_RunCMake_test(include_directories)
add_RunCMake_test(list)
add_RunCMake_test(try_compile)
+add_RunCMake_test(variable_watch)
add_RunCMake_test(CMP0004)
find_package(Qt4 QUIET)
diff --git a/Tests/RunCMake/variable_watch/CMakeLists.txt b/Tests/RunCMake/variable_watch/CMakeLists.txt
new file mode 100644
index 0000000..e8db6b0
--- /dev/null
+++ b/Tests/RunCMake/variable_watch/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 2.8)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/variable_watch/ModifiedAccess-stderr.txt b/Tests/RunCMake/variable_watch/ModifiedAccess-stderr.txt
new file mode 100644
index 0000000..3ff96fc
--- /dev/null
+++ b/Tests/RunCMake/variable_watch/ModifiedAccess-stderr.txt
@@ -0,0 +1,4 @@
+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\)$
diff --git a/Tests/RunCMake/variable_watch/ModifiedAccess.cmake b/Tests/RunCMake/variable_watch/ModifiedAccess.cmake
new file mode 100644
index 0000000..87943b3
--- /dev/null
+++ b/Tests/RunCMake/variable_watch/ModifiedAccess.cmake
@@ -0,0 +1,3 @@
+set(b "a")
+variable_watch(b)
+set(b "b")
diff --git a/Tests/RunCMake/variable_watch/NoWatcher-stderr.txt b/Tests/RunCMake/variable_watch/NoWatcher-stderr.txt
new file mode 100644
index 0000000..d299429
--- /dev/null
+++ b/Tests/RunCMake/variable_watch/NoWatcher-stderr.txt
@@ -0,0 +1,5 @@
+my_func
+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\)$
diff --git a/Tests/RunCMake/variable_watch/NoWatcher.cmake b/Tests/RunCMake/variable_watch/NoWatcher.cmake
new file mode 100644
index 0000000..8a68efb
--- /dev/null
+++ b/Tests/RunCMake/variable_watch/NoWatcher.cmake
@@ -0,0 +1,8 @@
+function(my_func)
+ message("my_func")
+endfunction()
+variable_watch(a my_func)
+set(a "")
+
+variable_watch(b)
+set(b "")
diff --git a/Tests/RunCMake/variable_watch/RunCMakeTest.cmake b/Tests/RunCMake/variable_watch/RunCMakeTest.cmake
new file mode 100644
index 0000000..8d20476
--- /dev/null
+++ b/Tests/RunCMake/variable_watch/RunCMakeTest.cmake
@@ -0,0 +1,4 @@
+include(RunCMake)
+
+run_cmake(ModifiedAccess)
+run_cmake(NoWatcher)