[Cmake-commits] CMake branch, next, updated. v2.8.8-3232-g638d977

Stephen Kelly steveire at gmail.com
Tue Jun 19 03:12:24 EDT 2012


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  638d97765f5ff7f8d0ad91c796d110927e61fad6 (commit)
       via  e30d46e20ee71d57e09f83fafa39b7e464efe110 (commit)
      from  c3f1e258cf3126738dde56992e2a4c79ce4fb63a (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=638d97765f5ff7f8d0ad91c796d110927e61fad6
commit 638d97765f5ff7f8d0ad91c796d110927e61fad6
Merge: c3f1e25 e30d46e
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Tue Jun 19 03:12:21 2012 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Tue Jun 19 03:12:21 2012 -0400

    Merge topic 'Ninja-absolute-compile-commands' into next
    
    e30d46e Use full paths in compile_commands.json for out of source builds.


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e30d46e20ee71d57e09f83fafa39b7e464efe110
commit e30d46e20ee71d57e09f83fafa39b7e464efe110
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Mon Jun 18 19:59:33 2012 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Tue Jun 19 09:01:28 2012 +0200

    Use full paths in compile_commands.json for out of source builds.
    
    Clang tooling requires that paths in the directory and file JSON
    fields are relative to the directory field, but clang doesn't normalize
    the paths already. The result is that clang doesn't find the relevant
    entry for files which begin with ../.

diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 40348e6..f21cddb 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -644,13 +644,22 @@ void cmGlobalNinjaGenerator::AddCXXCompileCommand(
     *this->CompileCommandsStream << "," << std::endl;
     }
 
+  std::string sourceFileName = sourceFile;
+  if (!cmSystemTools::FileIsFullPath(sourceFileName.c_str()))
+    {
+    sourceFileName = cmSystemTools::CollapseFullPath(
+      sourceFileName.c_str(),
+      this->GetCMakeInstance()->GetHomeOutputDirectory());
+    }
+
+
   *this->CompileCommandsStream << "\n{\n"
      << "  \"directory\": \""
      << cmGlobalGenerator::EscapeJSON(buildFileDir) << "\",\n"
      << "  \"command\": \""
      << cmGlobalGenerator::EscapeJSON(commandLine) << "\",\n"
      << "  \"file\": \""
-     << cmGlobalGenerator::EscapeJSON(sourceFile) << "\"\n"
+     << cmGlobalGenerator::EscapeJSON(sourceFileName) << "\"\n"
      << "}";
 }
 
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index a362d13..0c8ae8d 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -492,6 +492,15 @@ cmNinjaTargetGenerator
     std::string escapedSourceFileName =
       this->LocalGenerator->ConvertToOutputFormat(
         sourceFileName.c_str(), cmLocalGenerator::SHELL);
+
+    if (!cmSystemTools::FileIsFullPath(escapedSourceFileName.c_str()))
+      {
+      escapedSourceFileName = cmSystemTools::CollapseFullPath(
+        escapedSourceFileName.c_str(),
+        this->GetGlobalGenerator()->GetCMakeInstance()->GetHomeOutputDirectory());
+      }
+
+
     compileObjectVars.Source = escapedSourceFileName.c_str();
     compileObjectVars.Object = objectFileName.c_str();
     compileObjectVars.Flags = vars["FLAGS"].c_str();

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

Summary of changes:
 Source/cmGlobalNinjaGenerator.cxx |   11 ++++++++++-
 Source/cmNinjaTargetGenerator.cxx |    9 +++++++++
 2 files changed, 19 insertions(+), 1 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list