[Cmake-commits] CMake branch, next, updated. v3.3.0-1310-g3d0efda

Ben Boeckel ben.boeckel at kitware.com
Fri Jul 24 14:29:19 EDT 2015


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  3d0efdaf68b888d3c62a397dba72e437b1fed111 (commit)
       via  594bafe52773c940fc3fb9cd9022a4d1a3a194c7 (commit)
      from  7ab052ade7f7567534186b062c47b06880e626ef (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3d0efdaf68b888d3c62a397dba72e437b1fed111
commit 3d0efdaf68b888d3c62a397dba72e437b1fed111
Merge: 7ab052a 594bafe
Author:     Ben Boeckel <ben.boeckel at kitware.com>
AuthorDate: Fri Jul 24 14:29:18 2015 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Fri Jul 24 14:29:18 2015 -0400

    Merge topic 'trace-expand' into next
    
    594bafe5 cmake: add --trace-expand option


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=594bafe52773c940fc3fb9cd9022a4d1a3a194c7
commit 594bafe52773c940fc3fb9cd9022a4d1a3a194c7
Author:     Ben Boeckel <ben.boeckel at kitware.com>
AuthorDate: Tue Jul 21 17:18:53 2015 -0400
Commit:     Ben Boeckel <ben.boeckel at kitware.com>
CommitDate: Thu Jul 23 15:33:10 2015 -0400

    cmake: add --trace-expand option
    
    The --trace option is helpful, but sometimes, what you're looking for is
    deep under many layers of function calls and figuring out what instance
    of the function call you're looking at is tedious to determine (usually
    involving patching and message()). Instead, add a --trace-expand option
    to trace while expanding commands into what CMake actually sees.

diff --git a/Help/manual/cmake.1.rst b/Help/manual/cmake.1.rst
index 4bd5a5e..9ce4971 100644
--- a/Help/manual/cmake.1.rst
+++ b/Help/manual/cmake.1.rst
@@ -113,14 +113,18 @@ Options
 ``--debug-output``
  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.
 
 ``--trace``
  Put cmake in trace mode.
 
- Print a trace of all calls made and from where with
- message(send_error ) calls.
+ Print a trace of all calls made and from where.
+
+``--trace-expand``
+ Put cmake in trace mode.
+
+ Like ``--trace``, but with variables expanded.
 
 ``--warn-uninitialized``
  Warn about uninitialized values.
diff --git a/Help/release/dev/trace-expand.rst b/Help/release/dev/trace-expand.rst
new file mode 100644
index 0000000..383326e
--- /dev/null
+++ b/Help/release/dev/trace-expand.rst
@@ -0,0 +1,5 @@
+trace-expand
+------------
+
+* Add ``--trace-expand`` argument to CMake. Acts like ``--trace``, but expands
+  variable references in the output.
diff --git a/Help/variable/CMAKE_POLICY_WARNING_CMPNNNN.rst b/Help/variable/CMAKE_POLICY_WARNING_CMPNNNN.rst
index 092fe3e..8de0d56 100644
--- a/Help/variable/CMAKE_POLICY_WARNING_CMPNNNN.rst
+++ b/Help/variable/CMAKE_POLICY_WARNING_CMPNNNN.rst
@@ -17,5 +17,5 @@ warn by default:
 This variable should not be set by a project in CMake code.  Project
 developers running CMake may set this variable in their cache to
 enable the warning (e.g. ``-DCMAKE_POLICY_WARNING_CMP<NNNN>=ON``).
-Alternatively, running :manual:`cmake(1)` with the ``--debug-output``
-or ``--trace`` option will also enable the warning.
+Alternatively, running :manual:`cmake(1)` with the ``--debug-output``,
+``--trace``, or ``--trace-expand`` option will also enable the warning.
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index ae69b24..7c98970 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -307,10 +307,21 @@ void cmMakefile::PrintCommandTrace(const cmListFileFunction& lff) const
   std::ostringstream msg;
   msg << this->GetExecutionFilePath() << "(" << lff.Line << "):  ";
   msg << lff.Name << "(";
+  bool expand = this->GetCMakeInstance()->GetTraceExpand();
+  std::string temp;
   for(std::vector<cmListFileArgument>::const_iterator i =
         lff.Arguments.begin(); i != lff.Arguments.end(); ++i)
     {
-    msg << i->Value;
+    if (expand)
+      {
+      temp = i->Value;
+      this->ExpandVariablesInString(temp);
+      msg << temp;
+      }
+    else
+      {
+      msg << i->Value;
+      }
     msg << " ";
     }
   msg << ")";
@@ -4802,7 +4813,8 @@ bool cmMakefile::PolicyOptionalWarningEnabled(std::string const& var)
       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();
   return cm->GetDebugOutput() || cm->GetTrace();
 }
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 7bf3832..6abdbed 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -121,6 +121,7 @@ void cmWarnUnusedCliWarning(const std::string& variable,
 cmake::cmake()
 {
   this->Trace = false;
+  this->TraceExpand = false;
   this->WarnUninitialized = false;
   this->WarnUnused = false;
   this->WarnUnusedCli = true;
@@ -617,10 +618,17 @@ void cmake::SetArgs(const std::vector<std::string>& args,
       std::cout << "Running with debug output on.\n";
       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)
       {
       std::cout << "Running with trace output on.\n";
       this->SetTrace(true);
+      this->SetTraceExpand(false);
       }
     else if(arg.find("--warn-uninitialized",0) == 0)
       {
diff --git a/Source/cmake.h b/Source/cmake.h
index f0f9411..20e49e3 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -270,6 +270,8 @@ class cmake
   // Do we want trace output during the cmake run.
   bool GetTrace() { return this->Trace;}
   void SetTrace(bool b) {  this->Trace = b;}
+  bool GetTraceExpand() { return this->TraceExpand;}
+  void SetTraceExpand(bool b) {  this->TraceExpand = b;}
   bool GetWarnUninitialized() { return this->WarnUninitialized;}
   void SetWarnUninitialized(bool b) {  this->WarnUninitialized = b;}
   bool GetWarnUnused() { return this->WarnUnused;}
@@ -378,6 +380,7 @@ private:
   WorkingMode CurrentWorkingMode;
   bool DebugOutput;
   bool Trace;
+  bool TraceExpand;
   bool WarnUninitialized;
   bool WarnUnused;
   bool WarnUnusedCli;
diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx
index c94ffec..a06b26f 100644
--- a/Source/cmakemain.cxx
+++ b/Source/cmakemain.cxx
@@ -83,6 +83,7 @@ static const char * cmDocumentationOptions[][2] =
    "useful on one try_compile at a time."},
   {"--debug-output", "Put cmake in a debug mode."},
   {"--trace", "Put cmake in trace mode."},
+  {"--trace-expand", "Put cmake in trace mode with variable expansion."},
   {"--warn-uninitialized", "Warn about uninitialized values."},
   {"--warn-unused-vars", "Warn about unused variables."},
   {"--no-warn-unused-cli", "Don't warn about command line options."},
diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
index 84d4cc9..cef6368 100644
--- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
@@ -140,6 +140,10 @@ set(RunCMake_TEST_OPTIONS --trace)
 run_cmake(trace)
 unset(RunCMake_TEST_OPTIONS)
 
+set(RunCMake_TEST_OPTIONS --trace-expand)
+run_cmake(trace-expand)
+unset(RunCMake_TEST_OPTIONS)
+
 set(RunCMake_TEST_OPTIONS --debug-trycompile)
 run_cmake(debug-trycompile)
 unset(RunCMake_TEST_OPTIONS)
diff --git a/Tests/RunCMake/CommandLine/trace-expand-stderr.txt b/Tests/RunCMake/CommandLine/trace-expand-stderr.txt
new file mode 100644
index 0000000..4fee9bc
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/trace-expand-stderr.txt
@@ -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 \)
diff --git a/Tests/RunCMake/CommandLine/trace-expand.cmake b/Tests/RunCMake/CommandLine/trace-expand.cmake
new file mode 100644
index 0000000..e69de29

-----------------------------------------------------------------------

Summary of changes:
 Help/manual/cmake.1.rst                                |   10 +++++++---
 Help/release/dev/trace-expand.rst                      |    5 +++++
 Help/variable/CMAKE_POLICY_WARNING_CMPNNNN.rst         |    4 ++--
 Source/cmMakefile.cxx                                  |   16 ++++++++++++++--
 Source/cmake.cxx                                       |    8 ++++++++
 Source/cmake.h                                         |    3 +++
 Source/cmakemain.cxx                                   |    1 +
 Tests/RunCMake/CommandLine/RunCMakeTest.cmake          |    4 ++++
 .../{trace-stderr.txt => trace-expand-stderr.txt}      |    2 +-
 .../RunCMake/CommandLine/trace-expand.cmake            |    0
 10 files changed, 45 insertions(+), 8 deletions(-)
 create mode 100644 Help/release/dev/trace-expand.rst
 copy Tests/RunCMake/CommandLine/{trace-stderr.txt => trace-expand-stderr.txt} (51%)
 copy Modules/IntelVSImplicitPath/hello.f => Tests/RunCMake/CommandLine/trace-expand.cmake (100%)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list