diff options
Diffstat (limited to 'Source/cmGlobalNinjaGenerator.cxx')
-rw-r--r-- | Source/cmGlobalNinjaGenerator.cxx | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index b405905..9829d19 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -704,13 +704,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" << "}"; } @@ -967,7 +976,7 @@ void cmGlobalNinjaGenerator::WriteTargetHelp(std::ostream& os) { WriteRule(*this->RulesFileStream, "HELP", - (ninjaCmd() + " -t tagets").c_str(), + (ninjaCmd() + " -t targets").c_str(), "All primary targets available:", "Rule for printing all primary targets available.", /*depfile=*/ "", |