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)
This commit is contained in:
commit
d3971ee603
@ -15,6 +15,7 @@ static const char* const cmVariableWatchAccessStrings[] =
|
|||||||
{
|
{
|
||||||
"READ_ACCESS",
|
"READ_ACCESS",
|
||||||
"UNKNOWN_READ_ACCESS",
|
"UNKNOWN_READ_ACCESS",
|
||||||
|
"UNKNOWN_DEFINED_ACCESS",
|
||||||
"ALLOWED_UNKNOWN_READ_ACCESS",
|
"ALLOWED_UNKNOWN_READ_ACCESS",
|
||||||
"MODIFIED_ACCESS",
|
"MODIFIED_ACCESS",
|
||||||
"REMOVED_ACCESS",
|
"REMOVED_ACCESS",
|
||||||
|
@ -117,24 +117,9 @@ void cmVariableWatchCommand::VariableAccessed(const std::string& variable,
|
|||||||
if ( !processed )
|
if ( !processed )
|
||||||
{
|
{
|
||||||
cmOStringStream msg;
|
cmOStringStream msg;
|
||||||
msg << "* Variable \"" << variable.c_str() << "\" was accessed using "
|
msg << "Variable \"" << variable.c_str() << "\" was accessed using "
|
||||||
<< accessString << " in: " << currentListFile << std::endl;
|
<< accessString << " with value \"" << newValue << "\".";
|
||||||
msg << " The value of the variable: \"" << newValue << "\"" << std::endl;
|
makefile->IssueMessage(cmake::LOG, msg.str());
|
||||||
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());
|
|
||||||
}
|
}
|
||||||
this->InCallback = false;
|
this->InCallback = false;
|
||||||
}
|
}
|
||||||
|
@ -77,6 +77,7 @@ add_RunCMake_test(include)
|
|||||||
add_RunCMake_test(include_directories)
|
add_RunCMake_test(include_directories)
|
||||||
add_RunCMake_test(list)
|
add_RunCMake_test(list)
|
||||||
add_RunCMake_test(try_compile)
|
add_RunCMake_test(try_compile)
|
||||||
|
add_RunCMake_test(variable_watch)
|
||||||
add_RunCMake_test(CMP0004)
|
add_RunCMake_test(CMP0004)
|
||||||
|
|
||||||
find_package(Qt4 QUIET)
|
find_package(Qt4 QUIET)
|
||||||
|
3
Tests/RunCMake/variable_watch/CMakeLists.txt
Normal file
3
Tests/RunCMake/variable_watch/CMakeLists.txt
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
cmake_minimum_required(VERSION 2.8)
|
||||||
|
project(${RunCMake_TEST} NONE)
|
||||||
|
include(${RunCMake_TEST}.cmake)
|
4
Tests/RunCMake/variable_watch/ModifiedAccess-stderr.txt
Normal file
4
Tests/RunCMake/variable_watch/ModifiedAccess-stderr.txt
Normal file
@ -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\)$
|
3
Tests/RunCMake/variable_watch/ModifiedAccess.cmake
Normal file
3
Tests/RunCMake/variable_watch/ModifiedAccess.cmake
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
set(b "a")
|
||||||
|
variable_watch(b)
|
||||||
|
set(b "b")
|
5
Tests/RunCMake/variable_watch/NoWatcher-stderr.txt
Normal file
5
Tests/RunCMake/variable_watch/NoWatcher-stderr.txt
Normal file
@ -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\)$
|
8
Tests/RunCMake/variable_watch/NoWatcher.cmake
Normal file
8
Tests/RunCMake/variable_watch/NoWatcher.cmake
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
function(my_func)
|
||||||
|
message("my_func")
|
||||||
|
endfunction()
|
||||||
|
variable_watch(a my_func)
|
||||||
|
set(a "")
|
||||||
|
|
||||||
|
variable_watch(b)
|
||||||
|
set(b "")
|
4
Tests/RunCMake/variable_watch/RunCMakeTest.cmake
Normal file
4
Tests/RunCMake/variable_watch/RunCMakeTest.cmake
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
include(RunCMake)
|
||||||
|
|
||||||
|
run_cmake(ModifiedAccess)
|
||||||
|
run_cmake(NoWatcher)
|
Loading…
x
Reference in New Issue
Block a user