summaryrefslogtreecommitdiffstats
path: root/qmake/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'qmake/main.cpp')
-rw-r--r--qmake/main.cpp61
1 files changed, 23 insertions, 38 deletions
diff --git a/qmake/main.cpp b/qmake/main.cpp
index 3180d5c826..da2bd9eefb 100644
--- a/qmake/main.cpp
+++ b/qmake/main.cpp
@@ -1,37 +1,13 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 The Qt Company Ltd.
-** Copyright (C) 2016 Intel Corporation.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the qmake application of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// Copyright (C) 2016 Intel Corporation.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "project.h"
#include "property.h"
#include "option.h"
#include "cachekeys.h"
#include "metamakefile.h"
+#include <qcoreapplication.h>
#include <qnamespace.h>
#include <qdebug.h>
#include <qregularexpression.h>
@@ -150,7 +126,7 @@ static int doSed(int argc, char **argv)
}
if (inFiles.isEmpty())
inFiles << "-";
- for (const char *inFile : qAsConst(inFiles)) {
+ for (const char *inFile : std::as_const(inFiles)) {
FILE *f;
if (!strcmp(inFile, "-")) {
f = stdin;
@@ -340,8 +316,7 @@ static int installFileOrDirectory(const QString &source, const QString &target,
QDirIterator it(source, QDir::AllEntries | QDir::NoDotAndDotDot | QDir::Hidden);
while (it.hasNext()) {
- it.next();
- const QFileInfo &entry = it.fileInfo();
+ const QFileInfo entry = it.nextFileInfo();
const QString &entryTarget = target + QDir::separator() + entry.fileName();
const int recursionResult = installFileOrDirectory(entry.filePath(), entryTarget, true);
@@ -448,7 +423,7 @@ bool qmake_setpwd(const QString &p)
int runQMake(int argc, char **argv)
{
- qSetGlobalQHashSeed(0);
+ QHashSeed::setDeterministicGlobalSeed();
// stderr is unbuffered by default, but stdout buffering depends on whether
// there is a terminal attached. Buffering can make output from stderr and stdout
@@ -504,14 +479,22 @@ int runQMake(int argc, char **argv)
Option::output_dir = dir.path();
QString absoluteFilePath = QDir::cleanPath(fi.absoluteFilePath());
- Option::output.setFileName(absoluteFilePath.mid(Option::output_dir.length() + 1));
+ Option::output.setFileName(absoluteFilePath.mid(Option::output_dir.size() + 1));
}
QMakeProperty prop;
- if(Option::qmake_mode == Option::QMAKE_QUERY_PROPERTY ||
- Option::qmake_mode == Option::QMAKE_SET_PROPERTY ||
- Option::qmake_mode == Option::QMAKE_UNSET_PROPERTY)
- return prop.exec() ? 0 : 101;
+ switch (Option::qmake_mode) {
+ case Option::QMAKE_QUERY_PROPERTY:
+ return prop.queryProperty(Option::prop::properties);
+ case Option::QMAKE_SET_PROPERTY:
+ return prop.setProperty(Option::prop::properties);
+ case Option::QMAKE_UNSET_PROPERTY:
+ prop.unsetProperty(Option::prop::properties);
+ return 0;
+ default:
+ break;
+ }
+
globals.setQMakeProperty(&prop);
ProFileCache proFileCache;
@@ -548,7 +531,7 @@ int runQMake(int argc, char **argv)
if(!qmake_setpwd(fn.left(di)))
fprintf(stderr, "Cannot find directory: %s\n",
QDir::toNativeSeparators(fn.left(di)).toLatin1().constData());
- fn = fn.right(fn.length() - di - 1);
+ fn = fn.right(fn.size() - di - 1);
}
Option::prepareProject(fn);
@@ -590,5 +573,7 @@ QT_END_NAMESPACE
int main(int argc, char **argv)
{
+ // Set name of the qmake application in QCoreApplication instance
+ QT_PREPEND_NAMESPACE(QCoreApplication) app(argc, argv);
return QT_PREPEND_NAMESPACE(runQMake)(argc, argv);
}