Skip to content

Commit

Permalink
moc: Always indentify as moc
Browse files Browse the repository at this point in the history
External tools might rely on the output of "moc --version" to identify
moc, and, depending on how robust their parsing is, could break if the
reported name does not equal "moc".

Explicitly set the application name to moc, so that even if the moc
binary gets renamed and invoked via a symlink, it will still correctly
identify itself.

This might help with both binaries from the Qt Company's installer, as
well as with distros which rename moc to moc6.

Pick-to: 6.5
Task-number: QLS-1605
Change-Id: Id85e2ffa17d445213da0b37e7bd038d7b68e2c2a
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit 47be32b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 510f800)
  • Loading branch information
Inkane authored and Qt Cherry-pick Bot committed Dec 16, 2024
1 parent 6bf0b40 commit 0928a18
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/tools/moc/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,8 @@ int runMoc(int argc, char **argv)
{
QCoreApplication app(argc, argv);
QCoreApplication::setApplicationVersion(QString::fromLatin1(QT_VERSION_STR));
// let moc identify itself as moc, even if the binary has been renamed
QCoreApplication::setApplicationName(QString::fromLatin1("moc"));

bool autoInclude = true;
bool defaultInclude = true;
Expand Down

0 comments on commit 0928a18

Please sign in to comment.