commit
280dde34dd
|
@ -113,14 +113,18 @@ Options
|
||||||
``--debug-output``
|
``--debug-output``
|
||||||
Put cmake in a debug mode.
|
Put cmake in a debug mode.
|
||||||
|
|
||||||
Print extra stuff during the cmake run like stack traces with
|
Print extra information during the cmake run like stack traces with
|
||||||
message(send_error ) calls.
|
message(send_error ) calls.
|
||||||
|
|
||||||
``--trace``
|
``--trace``
|
||||||
Put cmake in trace mode.
|
Put cmake in trace mode.
|
||||||
|
|
||||||
Print a trace of all calls made and from where with
|
Print a trace of all calls made and from where.
|
||||||
message(send_error ) calls.
|
|
||||||
|
``--trace-expand``
|
||||||
|
Put cmake in trace mode.
|
||||||
|
|
||||||
|
Like ``--trace``, but with variables expanded.
|
||||||
|
|
||||||
``--warn-uninitialized``
|
``--warn-uninitialized``
|
||||||
Warn about uninitialized values.
|
Warn about uninitialized values.
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
trace-expand
|
||||||
|
------------
|
||||||
|
|
||||||
|
* Add ``--trace-expand`` argument to CMake. Acts like ``--trace``, but expands
|
||||||
|
variable references in the output.
|
|
@ -17,5 +17,5 @@ warn by default:
|
||||||
This variable should not be set by a project in CMake code. Project
|
This variable should not be set by a project in CMake code. Project
|
||||||
developers running CMake may set this variable in their cache to
|
developers running CMake may set this variable in their cache to
|
||||||
enable the warning (e.g. ``-DCMAKE_POLICY_WARNING_CMP<NNNN>=ON``).
|
enable the warning (e.g. ``-DCMAKE_POLICY_WARNING_CMP<NNNN>=ON``).
|
||||||
Alternatively, running :manual:`cmake(1)` with the ``--debug-output``
|
Alternatively, running :manual:`cmake(1)` with the ``--debug-output``,
|
||||||
or ``--trace`` option will also enable the warning.
|
``--trace``, or ``--trace-expand`` option will also enable the warning.
|
||||||
|
|
|
@ -339,10 +339,21 @@ void cmMakefile::PrintCommandTrace(const cmListFileFunction& lff) const
|
||||||
std::ostringstream msg;
|
std::ostringstream msg;
|
||||||
msg << this->GetExecutionFilePath() << "(" << lff.Line << "): ";
|
msg << this->GetExecutionFilePath() << "(" << lff.Line << "): ";
|
||||||
msg << lff.Name << "(";
|
msg << lff.Name << "(";
|
||||||
|
bool expand = this->GetCMakeInstance()->GetTraceExpand();
|
||||||
|
std::string temp;
|
||||||
for(std::vector<cmListFileArgument>::const_iterator i =
|
for(std::vector<cmListFileArgument>::const_iterator i =
|
||||||
lff.Arguments.begin(); i != lff.Arguments.end(); ++i)
|
lff.Arguments.begin(); i != lff.Arguments.end(); ++i)
|
||||||
{
|
{
|
||||||
|
if (expand)
|
||||||
|
{
|
||||||
|
temp = i->Value;
|
||||||
|
this->ExpandVariablesInString(temp);
|
||||||
|
msg << temp;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
msg << i->Value;
|
msg << i->Value;
|
||||||
|
}
|
||||||
msg << " ";
|
msg << " ";
|
||||||
}
|
}
|
||||||
msg << ")";
|
msg << ")";
|
||||||
|
@ -4773,7 +4784,8 @@ bool cmMakefile::PolicyOptionalWarningEnabled(std::string const& var)
|
||||||
return cmSystemTools::IsOn(val);
|
return cmSystemTools::IsOn(val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Enable optional policy warnings with --debug-output or --trace.
|
// Enable optional policy warnings with --debug-output, --trace,
|
||||||
|
// or --trace-expand.
|
||||||
cmake* cm = this->GetCMakeInstance();
|
cmake* cm = this->GetCMakeInstance();
|
||||||
return cm->GetDebugOutput() || cm->GetTrace();
|
return cm->GetDebugOutput() || cm->GetTrace();
|
||||||
}
|
}
|
||||||
|
|
|
@ -121,6 +121,7 @@ void cmWarnUnusedCliWarning(const std::string& variable,
|
||||||
cmake::cmake()
|
cmake::cmake()
|
||||||
{
|
{
|
||||||
this->Trace = false;
|
this->Trace = false;
|
||||||
|
this->TraceExpand = false;
|
||||||
this->WarnUninitialized = false;
|
this->WarnUninitialized = false;
|
||||||
this->WarnUnused = false;
|
this->WarnUnused = false;
|
||||||
this->WarnUnusedCli = true;
|
this->WarnUnusedCli = true;
|
||||||
|
@ -617,10 +618,17 @@ void cmake::SetArgs(const std::vector<std::string>& args,
|
||||||
std::cout << "Running with debug output on.\n";
|
std::cout << "Running with debug output on.\n";
|
||||||
this->SetDebugOutputOn(true);
|
this->SetDebugOutputOn(true);
|
||||||
}
|
}
|
||||||
|
else if(arg.find("--trace-expand",0) == 0)
|
||||||
|
{
|
||||||
|
std::cout << "Running with expanded trace output on.\n";
|
||||||
|
this->SetTrace(true);
|
||||||
|
this->SetTraceExpand(true);
|
||||||
|
}
|
||||||
else if(arg.find("--trace",0) == 0)
|
else if(arg.find("--trace",0) == 0)
|
||||||
{
|
{
|
||||||
std::cout << "Running with trace output on.\n";
|
std::cout << "Running with trace output on.\n";
|
||||||
this->SetTrace(true);
|
this->SetTrace(true);
|
||||||
|
this->SetTraceExpand(false);
|
||||||
}
|
}
|
||||||
else if(arg.find("--warn-uninitialized",0) == 0)
|
else if(arg.find("--warn-uninitialized",0) == 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -270,6 +270,8 @@ class cmake
|
||||||
// Do we want trace output during the cmake run.
|
// Do we want trace output during the cmake run.
|
||||||
bool GetTrace() { return this->Trace;}
|
bool GetTrace() { return this->Trace;}
|
||||||
void SetTrace(bool b) { this->Trace = b;}
|
void SetTrace(bool b) { this->Trace = b;}
|
||||||
|
bool GetTraceExpand() { return this->TraceExpand;}
|
||||||
|
void SetTraceExpand(bool b) { this->TraceExpand = b;}
|
||||||
bool GetWarnUninitialized() { return this->WarnUninitialized;}
|
bool GetWarnUninitialized() { return this->WarnUninitialized;}
|
||||||
void SetWarnUninitialized(bool b) { this->WarnUninitialized = b;}
|
void SetWarnUninitialized(bool b) { this->WarnUninitialized = b;}
|
||||||
bool GetWarnUnused() { return this->WarnUnused;}
|
bool GetWarnUnused() { return this->WarnUnused;}
|
||||||
|
@ -378,6 +380,7 @@ private:
|
||||||
WorkingMode CurrentWorkingMode;
|
WorkingMode CurrentWorkingMode;
|
||||||
bool DebugOutput;
|
bool DebugOutput;
|
||||||
bool Trace;
|
bool Trace;
|
||||||
|
bool TraceExpand;
|
||||||
bool WarnUninitialized;
|
bool WarnUninitialized;
|
||||||
bool WarnUnused;
|
bool WarnUnused;
|
||||||
bool WarnUnusedCli;
|
bool WarnUnusedCli;
|
||||||
|
|
|
@ -83,6 +83,7 @@ static const char * cmDocumentationOptions[][2] =
|
||||||
"useful on one try_compile at a time."},
|
"useful on one try_compile at a time."},
|
||||||
{"--debug-output", "Put cmake in a debug mode."},
|
{"--debug-output", "Put cmake in a debug mode."},
|
||||||
{"--trace", "Put cmake in trace mode."},
|
{"--trace", "Put cmake in trace mode."},
|
||||||
|
{"--trace-expand", "Put cmake in trace mode with variable expansion."},
|
||||||
{"--warn-uninitialized", "Warn about uninitialized values."},
|
{"--warn-uninitialized", "Warn about uninitialized values."},
|
||||||
{"--warn-unused-vars", "Warn about unused variables."},
|
{"--warn-unused-vars", "Warn about unused variables."},
|
||||||
{"--no-warn-unused-cli", "Don't warn about command line options."},
|
{"--no-warn-unused-cli", "Don't warn about command line options."},
|
||||||
|
|
|
@ -140,6 +140,10 @@ set(RunCMake_TEST_OPTIONS --trace)
|
||||||
run_cmake(trace)
|
run_cmake(trace)
|
||||||
unset(RunCMake_TEST_OPTIONS)
|
unset(RunCMake_TEST_OPTIONS)
|
||||||
|
|
||||||
|
set(RunCMake_TEST_OPTIONS --trace-expand)
|
||||||
|
run_cmake(trace-expand)
|
||||||
|
unset(RunCMake_TEST_OPTIONS)
|
||||||
|
|
||||||
set(RunCMake_TEST_OPTIONS --debug-trycompile)
|
set(RunCMake_TEST_OPTIONS --debug-trycompile)
|
||||||
run_cmake(debug-trycompile)
|
run_cmake(debug-trycompile)
|
||||||
unset(RunCMake_TEST_OPTIONS)
|
unset(RunCMake_TEST_OPTIONS)
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
^.*/Tests/RunCMake/CommandLine/CMakeLists.txt\(1\): cmake_minimum_required\(VERSION 3.0 \)
|
||||||
|
.*/Tests/RunCMake/CommandLine/CMakeLists.txt\(2\): project\(trace-expand NONE \)
|
Loading…
Reference in New Issue