mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-03 21:00:01 -05:00
cmListFileCache: Simplify relative path conversion in backtraces
Printing paths to CMake input files does not need to use the generator-wide relative path conversion rules because we are not actually generating a relative path for the build system that needs to be consistent with anything else. Instead, simply print a relative path if it does not need to start in `../`, and otherwise an absolute path.
This commit is contained in:
@@ -15,7 +15,6 @@
|
||||
#include "cmMessageType.h"
|
||||
#include "cmMessenger.h"
|
||||
#include "cmState.h"
|
||||
#include "cmStateDirectory.h"
|
||||
#include "cmStringAlgorithms.h"
|
||||
#include "cmSystemTools.h"
|
||||
|
||||
@@ -550,7 +549,7 @@ void cmListFileBacktrace::PrintTitle(std::ostream& out) const
|
||||
cmListFileContext lfc = this->TopEntry->Context;
|
||||
cmStateSnapshot bottom = this->GetBottom();
|
||||
if (!bottom.GetState()->GetIsInTryCompile()) {
|
||||
lfc.FilePath = bottom.GetDirectory().ConvertToRelPathIfContained(
|
||||
lfc.FilePath = cmSystemTools::RelativeIfUnder(
|
||||
bottom.GetState()->GetSourceDirectory(), lfc.FilePath);
|
||||
}
|
||||
out << (lfc.Line ? " at " : " in ") << lfc;
|
||||
@@ -581,7 +580,7 @@ void cmListFileBacktrace::PrintCallStack(std::ostream& out) const
|
||||
}
|
||||
cmListFileContext lfc = cur->Context;
|
||||
if (!bottom.GetState()->GetIsInTryCompile()) {
|
||||
lfc.FilePath = bottom.GetDirectory().ConvertToRelPathIfContained(
|
||||
lfc.FilePath = cmSystemTools::RelativeIfUnder(
|
||||
bottom.GetState()->GetSourceDirectory(), lfc.FilePath);
|
||||
}
|
||||
out << " " << lfc << "\n";
|
||||
|
||||
Reference in New Issue
Block a user