summaryrefslogtreecommitdiffstats
path: root/Source/cmQtAutoGenerator.cxx
diff options
context:
space:
mode:
authorSebastian Holtermann <sebholt@xwmw.org>2019-09-09 15:04:51 (GMT)
committerSebastian Holtermann <sebholt@xwmw.org>2019-09-16 16:18:48 (GMT)
commitf9e5441eb43d3238211685cded447141082e37b8 (patch)
treea4332235879289fc5e23e64e6c37988d0d632b26 /Source/cmQtAutoGenerator.cxx
parent51676cf65590f7a9bc3ad247151ee5bdc768eb77 (diff)
downloadCMake-f9e5441eb43d3238211685cded447141082e37b8.zip
CMake-f9e5441eb43d3238211685cded447141082e37b8.tar.gz
CMake-f9e5441eb43d3238211685cded447141082e37b8.tar.bz2
Autogen: Abbreviate file paths in messages
This introduces the `cmQtAutoGenerator::MessagePath` method, that abbreviates paths by placing a - "SRC:" prefix in place of the project source directory - "BIN:" prefix in place of the project binary directory The method is used in `AUTO{MOC,UIC,RCC}` when paths are displayed in messages. This makes the messages generated by `AUTO{MOC,UIC,RCC}` shorter and improves their readability.
Diffstat (limited to 'Source/cmQtAutoGenerator.cxx')
-rw-r--r--Source/cmQtAutoGenerator.cxx31
1 files changed, 15 insertions, 16 deletions
diff --git a/Source/cmQtAutoGenerator.cxx b/Source/cmQtAutoGenerator.cxx
index 80b8741..086b68c 100644
--- a/Source/cmQtAutoGenerator.cxx
+++ b/Source/cmQtAutoGenerator.cxx
@@ -93,32 +93,18 @@ void cmQtAutoGenerator::Logger::Warning(GenT genType,
}
}
-void cmQtAutoGenerator::Logger::WarningFile(GenT genType,
- cm::string_view filename,
- cm::string_view message) const
-{
- Warning(genType, cmStrCat(" ", Quoted(filename), '\n', message));
-}
-
void cmQtAutoGenerator::Logger::Error(GenT genType,
cm::string_view message) const
{
std::string msg =
- cmStrCat(HeadLine(cmStrCat(GeneratorName(genType), " error")), message,
- cmHasSuffix(message, '\n') ? "\n" : "\n\n");
+ cmStrCat('\n', HeadLine(cmStrCat(GeneratorName(genType), " error")),
+ message, cmHasSuffix(message, '\n') ? "\n" : "\n\n");
{
std::lock_guard<std::mutex> lock(Mutex_);
cmSystemTools::Stderr(msg);
}
}
-void cmQtAutoGenerator::Logger::ErrorFile(GenT genType,
- cm::string_view filename,
- cm::string_view message) const
-{
- Error(genType, cmStrCat(" ", Quoted(filename), '\n', message));
-}
-
void cmQtAutoGenerator::Logger::ErrorCommand(
GenT genType, cm::string_view message,
std::vector<std::string> const& command, std::string const& output) const
@@ -286,3 +272,16 @@ std::string cmQtAutoGenerator::SettingsFind(std::string const& content,
}
return std::string();
}
+
+std::string cmQtAutoGenerator::MessagePath(cm::string_view path) const
+{
+ std::string res;
+ if (cmHasPrefix(path, ProjectDirs().Source)) {
+ res = cmStrCat("SRC:", path.substr(ProjectDirs().Source.size()));
+ } else if (cmHasPrefix(path, ProjectDirs().Binary)) {
+ res = cmStrCat("BIN:", path.substr(ProjectDirs().Binary.size()));
+ } else {
+ res = std::string(path);
+ }
+ return cmQtAutoGen::Quoted(res);
+}