summaryrefslogtreecommitdiffstats
path: root/qmake
diff options
context:
space:
mode:
Diffstat (limited to 'qmake')
-rw-r--r--qmake/CMakeLists.txt49
-rw-r--r--qmake/cachekeys.h31
-rw-r--r--qmake/doc/qmake.qdocconf12
-rw-r--r--qmake/doc/snippets/code/doc_src_qmake-manual.cpp51
-rw-r--r--qmake/doc/snippets/code/doc_src_qmake-manual.pro90
-rw-r--r--qmake/doc/snippets/qmake/delegate.h51
-rw-r--r--qmake/doc/snippets/qmake/main.cpp51
-rw-r--r--qmake/doc/snippets/qmake/model.cpp51
-rw-r--r--qmake/doc/snippets/qmake/model.h51
-rw-r--r--qmake/doc/snippets/qmake/paintwidget_mac.cpp51
-rw-r--r--qmake/doc/snippets/qmake/paintwidget_unix.cpp51
-rw-r--r--qmake/doc/snippets/qmake/paintwidget_win.cpp51
-rw-r--r--qmake/doc/snippets/qmake/precompile-stable.h51
-rw-r--r--qmake/doc/snippets/qmake/view.h51
-rw-r--r--qmake/doc/src/qmake-manual.qdoc390
-rw-r--r--qmake/generators/mac/pbuilder_pbx.cpp80
-rw-r--r--qmake/generators/mac/pbuilder_pbx.h29
-rw-r--r--qmake/generators/makefile.cpp214
-rw-r--r--qmake/generators/makefile.h45
-rw-r--r--qmake/generators/makefiledeps.cpp112
-rw-r--r--qmake/generators/makefiledeps.h29
-rw-r--r--qmake/generators/metamakefile.cpp58
-rw-r--r--qmake/generators/metamakefile.h29
-rw-r--r--qmake/generators/projectgenerator.cpp61
-rw-r--r--qmake/generators/projectgenerator.h29
-rw-r--r--qmake/generators/unix/unixmake.cpp48
-rw-r--r--qmake/generators/unix/unixmake.h31
-rw-r--r--qmake/generators/unix/unixmake2.cpp114
-rw-r--r--qmake/generators/win32/mingw_make.cpp53
-rw-r--r--qmake/generators/win32/mingw_make.h30
-rw-r--r--qmake/generators/win32/msbuild_objectmodel.cpp80
-rw-r--r--qmake/generators/win32/msbuild_objectmodel.h29
-rw-r--r--qmake/generators/win32/msvc_nmake.cpp56
-rw-r--r--qmake/generators/win32/msvc_nmake.h30
-rw-r--r--qmake/generators/win32/msvc_objectmodel.cpp148
-rw-r--r--qmake/generators/win32/msvc_objectmodel.h34
-rw-r--r--qmake/generators/win32/msvc_vcproj.cpp74
-rw-r--r--qmake/generators/win32/msvc_vcproj.h29
-rw-r--r--qmake/generators/win32/msvc_vcxproj.cpp29
-rw-r--r--qmake/generators/win32/msvc_vcxproj.h29
-rw-r--r--qmake/generators/win32/winmakefile.cpp45
-rw-r--r--qmake/generators/win32/winmakefile.h29
-rw-r--r--qmake/generators/xmloutput.cpp57
-rw-r--r--qmake/generators/xmloutput.h29
-rw-r--r--qmake/library/ioutils.cpp61
-rw-r--r--qmake/library/ioutils.h29
-rw-r--r--qmake/library/proitems.cpp58
-rw-r--r--qmake/library/proitems.h29
-rw-r--r--qmake/library/qmake_global.h29
-rw-r--r--qmake/library/qmakebuiltins.cpp121
-rw-r--r--qmake/library/qmakeevaluator.cpp62
-rw-r--r--qmake/library/qmakeevaluator.h29
-rw-r--r--qmake/library/qmakeevaluator_p.h29
-rw-r--r--qmake/library/qmakeglobals.cpp49
-rw-r--r--qmake/library/qmakeglobals.h29
-rw-r--r--qmake/library/qmakeparser.cpp48
-rw-r--r--qmake/library/qmakeparser.h29
-rw-r--r--qmake/library/qmakevfs.cpp29
-rw-r--r--qmake/library/qmakevfs.h29
-rw-r--r--qmake/library/registry.cpp29
-rw-r--r--qmake/library/registry_p.h29
-rw-r--r--qmake/main.cpp39
-rw-r--r--qmake/meta.cpp29
-rw-r--r--qmake/meta.h29
-rw-r--r--qmake/option.cpp73
-rw-r--r--qmake/option.h29
-rw-r--r--qmake/project.cpp31
-rw-r--r--qmake/project.h29
-rw-r--r--qmake/property.cpp32
-rw-r--r--qmake/property.h29
-rw-r--r--qmake/propertyprinter.cpp57
-rw-r--r--qmake/propertyprinter.h40
-rw-r--r--qmake/qmake_pch.h29
-rw-r--r--qmake/qmakelibraryinfo.cpp61
-rw-r--r--qmake/qmakelibraryinfo.h40
75 files changed, 999 insertions, 3008 deletions
diff --git a/qmake/CMakeLists.txt b/qmake/CMakeLists.txt
index 6eae6ecd39..5a54570194 100644
--- a/qmake/CMakeLists.txt
+++ b/qmake/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
# Generated from qmake.pro.
#####################################################################
@@ -12,12 +15,15 @@ qt_add_library(QtLibraryInfo OBJECT
propertyprinter.cpp propertyprinter.h
qmakelibraryinfo.cpp qmakelibraryinfo.h
)
-set_target_properties(QtLibraryInfo PROPERTIES
- COMPILE_OPTIONS $<TARGET_PROPERTY:Qt::Core,INTERFACE_COMPILE_OPTIONS>
- COMPILE_DEFINITIONS $<TARGET_PROPERTY:Qt::Core,INTERFACE_COMPILE_DEFINITIONS>
- INCLUDE_DIRECTORIES $<TARGET_PROPERTY:Qt::Core,INTERFACE_INCLUDE_DIRECTORIES>
- INCLUDE_DIRECTORIES $<TARGET_PROPERTY:Qt::CorePrivate,INTERFACE_INCLUDE_DIRECTORIES>
-)
+
+# Make sure we use same parameters when building QtLibraryInfo and other Qt libraries,
+# otherwise some compilers may have compilation errors, such as clang-cl.
+target_link_libraries(QtLibraryInfo PUBLIC PlatformCommonInternal)
+
+target_link_libraries(QtLibraryInfo PUBLIC Qt::CorePrivate)
+
+qt_internal_add_sync_header_dependencies(QtLibraryInfo Core)
+
target_include_directories(QtLibraryInfo PUBLIC
"${CMAKE_CURRENT_SOURCE_DIR}"
"${CMAKE_CURRENT_SOURCE_DIR}/library"
@@ -29,27 +35,28 @@ if("${hostdatadir}" STREQUAL "")
set(hostdatadir ".")
endif()
+qt_internal_library_deprecation_level(deprecation_define)
+
target_compile_definitions(QtLibraryInfo PUBLIC
PROEVALUATOR_FULL
QT_BUILD_QMAKE
QT_USE_QSTRINGBUILDER
- QT_NO_FOREACH
- QT_VERSION_STR="${PROJECT_VERSION}" # special case
- QT_VERSION_MAJOR=${PROJECT_VERSION_MAJOR} # special case
- QT_VERSION_MINOR=${PROJECT_VERSION_MINOR} # special case
- QT_VERSION_PATCH=${PROJECT_VERSION_PATCH} # special case
QT_HOST_MKSPEC="${QT_QMAKE_HOST_MKSPEC}"
QT_TARGET_MKSPEC="${QT_QMAKE_TARGET_MKSPEC}"
QT_HOST_DATADIR="${hostdatadir}"
+ ${deprecation_define}
)
+qt_internal_set_exceptions_flags(QtLibraryInfo OFF)
+
if(NOT QT_FEATURE_qmake)
return()
endif()
qt_get_tool_target_name(target_name qmake)
qt_internal_add_tool(${target_name}
- TOOLS_TARGET Core # special case
+ TRY_RUN
+ TOOLS_TARGET Core
USER_FACING
INSTALL_VERSIONED_LINK
SOURCES
@@ -90,8 +97,10 @@ qt_internal_add_tool(${target_name}
PRECOMPILED_HEADER
"qmake_pch.h"
LIBRARIES
- Qt::CorePrivate
QtLibraryInfo
+ NO_UNITY_BUILD_SOURCES
+ generators/win32/msvc_objectmodel.cpp # xml symbols clash with generators/win32/msbuild_objectmodel.cpp
+ library/qmakeparser.cpp # struct statics clashes with qmakeevaluator_p.h
)
qt_internal_return_unless_building_tools()
@@ -111,7 +120,6 @@ qt_internal_extend_target(${target_name} CONDITION MACOS
"-fconstant-cfstrings"
)
-# special case big
qt_internal_extend_target(${target_name} CONDITION WIN32
SOURCES
library/registry.cpp
@@ -119,24 +127,15 @@ qt_internal_extend_target(${target_name} CONDITION WIN32
_SCL_SECURE_NO_WARNINGS
)
-qt_internal_extend_target(${target_name} CONDITION CLANG AND WIN32
- COMPILE_OPTIONS
- "-fms-compatibility-version=19.00.23506"
- "-Wno-microsoft-enum-value"
-)
-
-# special case:
set_target_properties(${target_name} PROPERTIES
AUTOMOC OFF
AUTORCC OFF
AUTOUIC OFF
)
-qt_internal_apply_gc_binaries(${target_name} PRIVATE) # special case
-qt_skip_warnings_are_errors(${target_name}) # special case
+qt_internal_apply_gc_binaries(${target_name} PRIVATE)
+qt_skip_warnings_are_errors(${target_name})
-# special case begin
qt_internal_add_docs(${target_name}
doc/qmake.qdocconf
)
-# special case end
diff --git a/qmake/cachekeys.h b/qmake/cachekeys.h
index 2d2fd63951..d364912ee5 100644
--- a/qmake/cachekeys.h
+++ b/qmake/cachekeys.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** 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) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef CACHEKEYS_H
#define CACHEKEYS_H
@@ -90,7 +65,7 @@ struct FileInfoCacheKey
return hash;
}
inline bool isRelativePath(const QString &file) {
- int length = file.length();
+ int length = file.size();
if (!length)
return true;
diff --git a/qmake/doc/qmake.qdocconf b/qmake/doc/qmake.qdocconf
index 2cf74d5551..4de19f3f67 100644
--- a/qmake/doc/qmake.qdocconf
+++ b/qmake/doc/qmake.qdocconf
@@ -24,6 +24,8 @@ exampledirs = snippets
tagfile = qmake.tags
+macro.qtbug = "\\l{https://bugreports.qt.io/browse/\1}{\1}"
+
depends += \
activeqt \
qt3d \
@@ -47,8 +49,6 @@ depends += \
qtquick \
qtquickcontrols \
qtquickdialogs \
- qtscript \
- qtscripttools \
qtsensors \
qtserialport \
qtsql \
@@ -56,12 +56,6 @@ depends += \
qttestlib \
qtuitools \
qtwidgets \
- qtwinextras \
- qtx11extras \
- qtxml \
- qtxmlpatterns
+ qtxml
navigation.landingpage = "qmake Manual"
-
-# Fail the documentation build if there are more warnings than the limit
-warninglimit = 0
diff --git a/qmake/doc/snippets/code/doc_src_qmake-manual.cpp b/qmake/doc/snippets/code/doc_src_qmake-manual.cpp
index 975fdb15df..5e545f33b3 100644
--- a/qmake/doc/snippets/code/doc_src_qmake-manual.cpp
+++ b/qmake/doc/snippets/code/doc_src_qmake-manual.cpp
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
//! [104]
// Add C includes here
diff --git a/qmake/doc/snippets/code/doc_src_qmake-manual.pro b/qmake/doc/snippets/code/doc_src_qmake-manual.pro
index d36d926b66..bb803d11b6 100644
--- a/qmake/doc/snippets/code/doc_src_qmake-manual.pro
+++ b/qmake/doc/snippets/code/doc_src_qmake-manual.pro
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#! [0]
make all
@@ -991,3 +944,42 @@ win32-g++:contains(QMAKE_HOST.arch, x86_64):{
...
}
#! [187]
+
+#! [188]
+translations_en.files = $$PWD/en.lproj/InfoPlist.strings
+translations_en.path = en.lproj
+QMAKE_BUNDLE_DATA += translations_en
+#! [188]
+
+#! [189]
+# Approach 1
+translations_en.files = $$PWD/InfoPlist.strings
+translations_en.path = en.lproj
+
+# Approach 2
+translations_de.files = $$PWD/de.lproj/InfoPlist.strings
+
+QMAKE_BUNDLE_DATA += translations_en translations_de
+#! [189]
+
+#! [TR_EXCLUDE sources]
+SOURCES += main.cpp \
+ excluded.cpp \
+ 3rdparty/sqlite3.h \
+ 3rdparty/sqlite3.c
+TR_EXCLUDE += excluded.cpp 3rdparty/*
+#! [TR_EXCLUDE sources]
+
+#! [TR_EXCLUDE SUBDIRS]
+SUBDIRS += \
+ libs \
+ apps \
+ tests
+TR_EXCLUDE += tests
+#! [TR_EXCLUDE SUBDIRS]
+
+#! [TR_EXCLUDE include paths]
+linux {
+ TR_EXCLUDE += /usr/include/boost/*
+}
+#! [TR_EXCLUDE include paths]
diff --git a/qmake/doc/snippets/qmake/delegate.h b/qmake/doc/snippets/qmake/delegate.h
index 69aa01e5db..354483e69b 100644
--- a/qmake/doc/snippets/qmake/delegate.h
+++ b/qmake/doc/snippets/qmake/delegate.h
@@ -1,50 +1,3 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
diff --git a/qmake/doc/snippets/qmake/main.cpp b/qmake/doc/snippets/qmake/main.cpp
index 69aa01e5db..354483e69b 100644
--- a/qmake/doc/snippets/qmake/main.cpp
+++ b/qmake/doc/snippets/qmake/main.cpp
@@ -1,50 +1,3 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
diff --git a/qmake/doc/snippets/qmake/model.cpp b/qmake/doc/snippets/qmake/model.cpp
index 69aa01e5db..354483e69b 100644
--- a/qmake/doc/snippets/qmake/model.cpp
+++ b/qmake/doc/snippets/qmake/model.cpp
@@ -1,50 +1,3 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
diff --git a/qmake/doc/snippets/qmake/model.h b/qmake/doc/snippets/qmake/model.h
index 69aa01e5db..354483e69b 100644
--- a/qmake/doc/snippets/qmake/model.h
+++ b/qmake/doc/snippets/qmake/model.h
@@ -1,50 +1,3 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
diff --git a/qmake/doc/snippets/qmake/paintwidget_mac.cpp b/qmake/doc/snippets/qmake/paintwidget_mac.cpp
index 69aa01e5db..354483e69b 100644
--- a/qmake/doc/snippets/qmake/paintwidget_mac.cpp
+++ b/qmake/doc/snippets/qmake/paintwidget_mac.cpp
@@ -1,50 +1,3 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
diff --git a/qmake/doc/snippets/qmake/paintwidget_unix.cpp b/qmake/doc/snippets/qmake/paintwidget_unix.cpp
index 297e76fd05..48702fe94d 100644
--- a/qmake/doc/snippets/qmake/paintwidget_unix.cpp
+++ b/qmake/doc/snippets/qmake/paintwidget_unix.cpp
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
int main(int argc, char *argv[])
{
diff --git a/qmake/doc/snippets/qmake/paintwidget_win.cpp b/qmake/doc/snippets/qmake/paintwidget_win.cpp
index 69aa01e5db..354483e69b 100644
--- a/qmake/doc/snippets/qmake/paintwidget_win.cpp
+++ b/qmake/doc/snippets/qmake/paintwidget_win.cpp
@@ -1,50 +1,3 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
diff --git a/qmake/doc/snippets/qmake/precompile-stable.h b/qmake/doc/snippets/qmake/precompile-stable.h
index 400fd5abd8..d0b993c158 100644
--- a/qmake/doc/snippets/qmake/precompile-stable.h
+++ b/qmake/doc/snippets/qmake/precompile-stable.h
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
//! [0]
/* Add C includes here */
diff --git a/qmake/doc/snippets/qmake/view.h b/qmake/doc/snippets/qmake/view.h
index 69aa01e5db..354483e69b 100644
--- a/qmake/doc/snippets/qmake/view.h
+++ b/qmake/doc/snippets/qmake/view.h
@@ -1,50 +1,3 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
diff --git a/qmake/doc/src/qmake-manual.qdoc b/qmake/doc/src/qmake-manual.qdoc
index 9d3d15b9c1..31d3f824e7 100644
--- a/qmake/doc/src/qmake-manual.qdoc
+++ b/qmake/doc/src/qmake-manual.qdoc
@@ -1,29 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** 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 Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
\page qmake-manual.html
@@ -142,6 +118,9 @@
For more information about the environment variables that qmake uses when
configuring the build process, see \l{Configuring qmake}.
+ \note Add your project build directory to the list of excluded directories
+ of any anti-virus application that runs on your system.
+
\section1 Using Third Party Libraries
The guide to \l{Third Party Libraries} shows you how to use simple third
@@ -178,7 +157,6 @@
The following sections describe the different types of elements used
in project files.
- \target ProjectFileElementsVariables
\section2 Variables
In a project file, variables are used to hold lists of strings. In the
@@ -296,9 +274,10 @@
line as the condition.
More complex operations on variables that would usually require loops
- are provided by built-in functions such as \l{findfunction}{find()},
- \l{unique}{unique()}, and \l{countfunction}{count()}. These functions, and
- many others are provided to manipulate
+ are provided by built-in functions such as \l{find(variablename, substr)}
+ {find()}, \l{unique(variablename)}{unique()}, and
+ \l{count(variablename, number)}{count()}.
+ These functions, and many others are provided to manipulate
strings and paths, support user input, and call external tools. For more
information about using the functions, see \l{qmake Language}. For lists
of all functions and their descriptions, see \l{Replace Functions} and
@@ -345,7 +324,6 @@
The \c SUBDIRS variable is used to
contain a list of all the subdirectories to be processed.
- \target GeneralConfiguration
\section1 General Configuration
The \l{CONFIG} variable specifies the options and features that the project
@@ -512,9 +490,9 @@
You can use the \c options to specify both general and mode-specific
settings. Options that only apply to the Makefile mode are described in the
- \l{#MakefileMode}{Makefile Mode Options} section, whereas options that influence the
+ \l{Makefile Mode Options} section, whereas options that influence the
creation of project files are described in the
- \l{#ProjectMode}{Project Mode Options} section.
+ \l{Project Mode Options} section.
\section1 Files
@@ -575,7 +553,6 @@
files.
\endlist
- \target MakefileMode
\section1 Makefile Mode Options
\snippet code/doc_src_qmake-manual.pro 9
@@ -617,7 +594,6 @@
is specified, all assignments on the command line after the \c -after
option will be postponed until after the specified files are parsed.
- \target ProjectMode
\section1 Project Mode Options
\snippet code/doc_src_qmake-manual.pro 12
@@ -908,7 +884,6 @@
to specify a list of libraries that each project needs to link against,
and \c QMAKE_LIBS_X11 would be used to extend this list.
- \target ANDROID_ABIS
\section1 ANDROID_ABIS
\note This variable applies only to Android targets.
@@ -926,7 +901,6 @@
it is not recommended since it will override any ABIs specified on the
\c qmake command line.
- \target ANDROID_API_VERSION
\section1 ANDROID_API_VERSION
\note This variable applies only to Android targets.
@@ -934,7 +908,6 @@
Specifies the Android API level number. For more information, see
\l{Android: Build Numbers}{Android Build Numbers}.
- \target ANDROID_APPLICATION_ARGUMENTS
\section1 ANDROID_APPLICATION_ARGUMENTS
\note This variable applies only to Android targets.
@@ -947,7 +920,6 @@
ANDROID_APPLICATION_ARGUMENTS = "arg1 arg2 arg3"
\endcode
- \target ANDROID_BUNDLED_JAR_DEPENDENCIES
\section1 ANDROID_BUNDLED_JAR_DEPENDENCIES
\note This variable applies only to Android modules.
@@ -959,7 +931,6 @@
ANDROID_BUNDLED_JAR_DEPENDENCIES += jar/Qt6Android.jar
\endcode
- \target ANDROID_DEPLOYMENT_DEPENDENCIES
\section1 ANDROID_DEPLOYMENT_DEPENDENCIES
\note This variable applies only to Android targets.
@@ -978,7 +949,6 @@
provides a way to override the automatic detection entirely, so if a library
is listed before its dependencies, it will fail to load on some devices.
- \target ANDROID_DEPLOYMENT_SETTINGS_FILE
\section1 ANDROID_DEPLOYMENT_SETTINGS_FILE
\note This variable applies only to Android targets.
@@ -988,7 +958,6 @@
the settings file generated by qmake, thus you have to make sure to provide
a valid settings file.
- \target ANDROID_EXTRA_LIBS
\section1 ANDROID_EXTRA_LIBS
\note This variable applies only to Android targets.
@@ -1011,7 +980,6 @@
for (abi, ANDROID_ABIS): ANDROID_EXTRA_LIBS += $$PWD/library_name_$${abi}.so
\endcode
- \target ANDROID_EXTRA_PLUGINS
\section1 ANDROID_EXTRA_PLUGINS
\note This variable applies only to Android targets.
@@ -1052,7 +1020,6 @@
ANDROID_EXTRA_PLUGINS += $$top_builddir/plugins
\endcode
- \target ANDROID_FEATURES
\section1 ANDROID_FEATURES
\note This variable applies only to Android modules.
@@ -1065,7 +1032,6 @@
For more information, see \l{Android: <uses-feature>}{Android <uses-feature> Docs}.
- \target ANDROID_LIB_DEPENDENCIES
\section1 ANDROID_LIB_DEPENDENCIES
\note This variable applies only to Android modules.
@@ -1078,7 +1044,6 @@
plugins/libplugins_platforms_qtforandroid.so
\endcode
- \target ANDROID_MIN_SDK_VERSION
\section1 ANDROID_MIN_SDK_VERSION
\note This variable applies only to Android targets.
@@ -1086,7 +1051,6 @@
Specifies the minimum Android API level for the project. By default, this
variable is set to API level 23.
- \target ANDROID_PACKAGE_SOURCE_DIR
\section1 ANDROID_PACKAGE_SOURCE_DIR
\note This variable applies only to Android targets.
@@ -1107,7 +1071,6 @@
instance, you can make a custom \c {AndroidManifest.xml} for your application,
then place this directly into the directory specified by this variable.
- \target ANDROID_PERMISSIONS
\section1 ANDROID_PERMISSIONS
\note This variable applies only to Android modules.
@@ -1120,15 +1083,13 @@
For more information, see \l{Android: <uses-permission>}{Android <uses-permission> Docs}.
- \target ANDROID_TARGET_SDK_VERSION
\section1 ANDROID_TARGET_SDK_VERSION
\note This variable applies only to Android targets.
Specifies the target Android API level for the project. By default, this
- variable is set to API level 30.
+ variable is set to API level 34.
- \target ANDROID_VERSION_CODE
\section1 ANDROID_VERSION_CODE
\note This variable applies only to Android targets.
@@ -1136,7 +1097,6 @@
Specifies the application's version number. For more information, see
\l{Android: App Versioning}{Android App Versioning}.
- \target ANDROID_VERSION_NAME
\section1 ANDROID_VERSION_NAME
\note This variable applies only to Android targets.
@@ -1144,7 +1104,6 @@
Specifies the application's version in as a human readable string. For more
information, see \l{Android: App Versioning}{Android App Versioning}.
- \target CONFIG
\section1 CONFIG
Specifies project configuration and compiler options. The values are
@@ -1227,8 +1186,10 @@
By default, support is disabled.
\row \li c++2a \li Obsolete alias for c++20.
\row \li c++latest \li Support for the latest C++ language standard is
- enabled that is supported by the compiler. By default, this option is
- disabled.
+ enabled. This option is mostly useful for MSVC that supports a
+ \c{/std:c++latest} compiler argument. For other toolchains, this
+ option enables the latest C++ standard that is known to Qt. By
+ default, this option is disabled.
\row \li strict_c++ \li Disables support for C++ compiler extensions.
By default, they are enabled.
\row \li depend_includepath \li Appending the value of INCLUDEPATH to
@@ -1302,11 +1263,11 @@
qmake to track these dependencies. When this
option is enabled, qmake will create a file
with the extension \c .prl which will save meta-information about the library
- (see \l{LibDepend}{Library Dependencies} for more info).
+ (see \l{Library Dependencies} for more info).
\row \li link_prl \li When this option is enabled,
qmake will process all libraries linked to
by the application and find their meta-information (see
- \l{LibDepend}{Library Dependencies} for more info).
+ \l{Library Dependencies} for more info).
\row \li no_install_prl \li This option disables the generation of
installation rules for generated .prl files.
\endtable
@@ -1322,7 +1283,7 @@
\row \li qt \li The target is a Qt application or library and requires the Qt
library and header files. The proper include and library paths for the
Qt library will automatically be added to the project. This is defined
- by default, and can be fine-tuned with the \c{\l{#qt}{QT}} variable.
+ by default, and can be fine-tuned with the \l{#qt}{QT} variable.
\row \li x11 \li The target is an X11 application or library. The proper
include paths and libraries will automatically be added to the
project.
@@ -1413,7 +1374,6 @@
\snippet code/doc_src_qmake-manual.pro 26
- \target DEFINES
\section1 DEFINES
qmake adds the values of this variable as
@@ -1423,7 +1383,6 @@
\snippet code/doc_src_qmake-manual.pro 27
- \target DEFINES_DEBUG
\section1 DEFINES_DEBUG
Specifies preprocessor defines for the debug configuration. The values of
@@ -1433,7 +1392,6 @@
This variable was introduced in Qt 5.13.2.
- \target DEFINES_RELEASE
\section1 DEFINES_RELEASE
Specifies preprocessor defines for the release configuration. The values of
@@ -1446,21 +1404,18 @@
This variable was introduced in Qt 5.13.2.
- \target DEF_FILE
\section1 DEF_FILE
\note This variable is used only on Windows when using the \c app template.
Specifies a \c .def file to be included in the project.
- \target DEPENDPATH
\section1 DEPENDPATH
Specifies a list of directories for qmake to scan, to resolve dependencies.
This variable is used when qmake crawls through the header files that you
\c{#include} in your source code.
- \target DESTDIR
\section1 DESTDIR
Specifies where to put the \l{#TARGET}{target} file.
@@ -1473,7 +1428,6 @@
the used build tool. In particular, parentheses do not
work with \c{make}.
- \target DISTFILES
\section1 DISTFILES
Specifies a list of files to be included in the dist
@@ -1483,14 +1437,12 @@
\snippet code/doc_src_qmake-manual.pro 31
- \target DLLDESTDIR
\section1 DLLDESTDIR
\note This variable applies only to Windows targets.
Specifies where to copy the \l{#TARGET}{target} dll.
- \target EXTRA_TRANSLATIONS
\section1 EXTRA_TRANSLATIONS
Specifies a list of translation (.ts) files that contain
@@ -1508,18 +1460,17 @@
See the \l{Qt Linguist Manual} for more information about
internationalization (i18n) and localization (l10n) with Qt.
- \target FORMS
\section1 FORMS
- Specifies the UI files (see \l{Qt Designer Manual}) to be processed by \c uic
- before compiling. All dependencies, headers and source files required
- to build these UI files will automatically be added to the project.
+ Specifies the UI files (see \l{Qt Widgets Designer Manual}) to be processed
+ by \c uic before compiling. All dependencies, headers and source files
+ required to build these UI files will automatically be added to the
+ project.
For example:
\snippet code/doc_src_qmake-manual.pro 32
- \target GUID
\section1 GUID
Specifies the GUID that is set inside a \c{.vcproj} file. The GUID is
@@ -1529,7 +1480,6 @@
This variable is specific to \c{.vcproj} files only; it is ignored
otherwise.
- \target HEADERS
\section1 HEADERS
Defines the header files for the project.
@@ -1544,20 +1494,17 @@
See also \l{#SOURCES}{SOURCES}.
- \target ICON
\section1 ICON
This variable is used only on Mac OS to set the application icon.
Please see \l{Setting the Application Icon}{the application icon documentation}
for more information.
- \target IDLSOURCES
\section1 IDLSOURCES
This variable is used only on Windows for the Visual Studio project generation to
put the specified files in the Generated Files folder.
- \target INCLUDEPATH
\section1 INCLUDEPATH
Specifies the #include directories which should be
@@ -1572,7 +1519,6 @@
\snippet qmake/spaces.pro quoting include paths with spaces
- \target INSTALLS
\section1 INSTALLS
Specifies a list of resources that will be installed when
@@ -1626,28 +1572,24 @@
This variable is also used to specify which additional files will be
deployed to embedded devices.
- \target JAVA_HOME
\section1 JAVA_HOME
\note This variable is useful only to Android targets.
Specifies the JDK/OpenJDK installation path used for building the project.
- \target LEXIMPLS
\section1 LEXIMPLS
Specifies a list of Lex implementation files. The value
of this variable is typically handled by qmake or
\l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
- \target LEXOBJECTS
\section1 LEXOBJECTS
Specifies the names of intermediate Lex object
files. The value of this variable is typically handled by
qmake and rarely needs to be modified.
- \target LEXSOURCES
\section1 LEXSOURCES
Specifies a list of Lex source files. All
@@ -1658,7 +1600,6 @@
\snippet code/doc_src_qmake-manual.pro 37
- \target LIBS
\section1 LIBS
Specifies a list of libraries to be linked into the project.
@@ -1682,7 +1623,6 @@
\snippet code/doc_src_qmake-manual.pro 39
- \target LIBS_PRIVATE
\section1 LIBS_PRIVATE
Specifies a list of libraries to be linked privately into the project.
@@ -1695,7 +1635,6 @@
directly, it needs to link to A explicitly. Put differently, libraries
linked privately are not exposed transitively at build time.
- \target LITERAL_HASH
\section1 LITERAL_HASH
This variable is used whenever a literal hash character (\c{#}) is needed in
@@ -1709,14 +1648,12 @@
By using \c LITERAL_HASH in this way, the \c # character can be used
to construct a URL for the \c message() function to print to the console.
- \target MAKEFILE
\section1 MAKEFILE
Specifies the name of the generated Makefile. The value of this variable is
typically handled by qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs to
be modified.
- \target MAKEFILE_GENERATOR
\section1 MAKEFILE_GENERATOR
Specifies the name of the Makefile generator to use
@@ -1724,13 +1661,11 @@
handled internally by qmake and rarely needs to
be modified.
- \target MSVCPROJ_*
\section1 MSVCPROJ_*
These variables are handled internally by qmake and should not be modified
or utilized.
- \target MOC_DIR
\section1 MOC_DIR
Specifies the directory where all intermediate moc
@@ -1740,7 +1675,6 @@
\snippet code/doc_src_qmake-manual.pro 40
- \target OBJECTIVE_HEADERS
\section1 OBJECTIVE_HEADERS
Defines the Objective-C++ header files for the project.
@@ -1754,7 +1688,6 @@
See also \l{#OBJECTIVE_SOURCES}{OBJECTIVE_SOURCES}.
- \target OBJECTIVE_SOURCES
\section1 OBJECTIVE_SOURCES
Specifies the names of all Objective-C/C++ source files in the project.
@@ -1764,14 +1697,12 @@
See also \l{#OBJECTIVE_HEADERS}{OBJECTIVE_HEADERS}.
- \target OBJECTS
\section1 OBJECTS
This variable is automatically populated from the \l{SOURCES} variable.
The extension of each source file is replaced by .o (Unix) or .obj (Win32).
You can add objects to the list.
- \target OBJECTS_DIR
\section1 OBJECTS_DIR
Specifies the directory where all intermediate
@@ -1781,7 +1712,6 @@
\snippet code/doc_src_qmake-manual.pro 41
- \target POST_TARGETDEPS
\section1 POST_TARGETDEPS
Lists the libraries that the \l{#TARGET}{target} depends on. Some backends,
@@ -1793,7 +1723,6 @@
This list is placed after all builtin (and \link #PRE_TARGETDEPS
$$PRE_TARGETDEPS \endlink) dependencies.
- \target PRE_TARGETDEPS
\section1 PRE_TARGETDEPS
Lists libraries that the \l{#TARGET}{target} depends on. Some backends,
@@ -1804,7 +1733,6 @@
This list is placed before all builtin dependencies.
- \target PRECOMPILED_HEADER
\section1 PRECOMPILED_HEADER
Indicates the header file for creating a precompiled
@@ -1813,7 +1741,6 @@
(Windows - all MSVC project types, Apple - Xcode, Makefile,
Unix - gcc 3.3 and up).
- \target PWD
\section1 PWD
Specifies the full path leading to the directory
@@ -1825,7 +1752,6 @@
\note Do not attempt to overwrite the value of this variable.
- \target OUT_PWD
\section1 OUT_PWD
Specifies the full path leading to the directory where qmake places the
@@ -1833,7 +1759,6 @@
\note Do not attempt to overwrite the value of this variable.
- \target QM_FILES_RESOURCE_PREFIX
\section1 QM_FILES_RESOURCE_PREFIX
Specifies the directory in the resource system where \c .qm files will
@@ -1841,27 +1766,46 @@
The default is \c{:/i18n/}.
- \target QM_FILES_INSTALL_PATH
\section1 QM_FILES_INSTALL_PATH
Specifies the target directory \c .qm files generated by
\l{CONFIG}{CONFIG += lrelease} will be installed to. Does not have any
effect if \l{CONFIG}{CONFIG += embed_translations} is set.
- \target QML_IMPORT_PATH
\section1 QML_IMPORT_PATH
- This variable is only used by \l{Qt Creator Manual}{Qt Creator}.
+ This variable is only used by \l{Qt Creator Manual}{Qt Creator}. If you have
+ an extra module that is kept outside of your Qt installation, you can
+ specify its path here.
+
See \l{Qt Creator: Using QML Modules with Plugins} for details.
- \target QMAKE_systemvariable
+ \section1 QMLPATHS
+
+ Expects a list of import paths that point to root directories of trees of
+ QML modules. For example, if you have a custom location for your QML
+ modules, you can specify it here.
+
+ \note The path entries for QMLPATHS point to root directories of trees of
+ QML modules. This is the concept of import paths the QML engine understands.
+ You can pass the same paths via the \c QML_IMPORT_PATH \e environment variable
+ to your QML application, but they are \e different from the expected contents
+ of the \l QML_IMPORT_PATH \e qmake variable. The latter expects paths to
+ \e individual modules to be processed by Qt Creator only.
+
+ \note The contents of QMLPATHS are \e not automatically passed to your
+ application. Rather, they are only used at build time. In particular,
+ qmlimportscanner uses them to find any QML modules it may need to mark as
+ imported by your application.
+
+ \sa QQmlEngine::addImportPath()
+
\section1 QMAKE
Specifies the name of the qmake program itself and is placed in generated
Makefiles. The value of this variable is typically handled by qmake or
\l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
- \target QMAKESPEC_systemvariable
\section1 QMAKESPEC
A system variable that contains the full path of the qmake configuration that is used
@@ -1869,7 +1813,20 @@
\note Do not attempt to overwrite the value of this variable.
- \target QMAKE_AR_CMD
+ \section1 QMAKE_APPLE_DEVICE_ARCHS
+
+ \note This variable is used on \macos only.
+
+ Specifies a list of architectures to build for. By default, a project is
+ built for the development machine's architecture. This variable allows to
+ override the default and build for a different architecture or to create
+ multi-architecture binaries.
+
+ This variable is usually specified on the command line or in the project
+ file.
+
+ See \l{Qt for macOS} for more information.
+
\section1 QMAKE_AR_CMD
\note This variable is used on Unix platforms only.
@@ -1877,7 +1834,6 @@
Specifies the command to execute when creating a shared library. The value of this variable
is typically handled by qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
- \target QMAKE_BUNDLE_DATA
\section1 QMAKE_BUNDLE_DATA
\note This variable is used on \macos, iOS, tvOS, and watchOS only.
@@ -1900,6 +1856,33 @@
See \l{Platform Notes#Creating Frameworks}{Platform Notes} for
more information about creating library bundles.
+ A project can also use this variable to bundle application translation
+ files. The exact syntax depends on whether the project is using Xcode's
+ legacy build system or its new build system.
+
+ For example when the following project snippet is built using the
+ legacy build system:
+
+ \snippet code/doc_src_qmake-manual.pro 188
+
+ Xcode will ignore the original location of \c InfoPlist.strings
+ and the file will placed into the bundle \c Resources directory
+ under the provided \c translations_en.path path, so
+ \c Resources/en.lproj/InfoPlist.strings
+
+ With the new build system, the relative location of the file is
+ preserved, which means the file will incorrectly be placed under
+ \c Resources/en.lproj/en.lproj/InfoPlist.strings
+
+ To ensure correct file placement, the project can either move
+ the original file not to be in a sub-directory or it can choose
+ not to specify the \c translations_en.path variable.
+
+ \snippet code/doc_src_qmake-manual.pro 189
+
+ See \qtbug QTBUG-98417 for more details on how the Xcode build
+ system changed its behavior in bundling translation files.
+
\section1 QMAKE_BUNDLE_EXTENSION
\note This variable is used on \macos, iOS, tvOS, and watchOS only.
@@ -1929,21 +1912,18 @@
adjusted by modifying the \c QMAKE_CFLAGS_DEBUG and
\c QMAKE_CFLAGS_RELEASE variables, respectively.
- \target QMAKE_CFLAGS_DEBUG
\section1 QMAKE_CFLAGS_DEBUG
Specifies the C compiler flags for debug builds.
The value of this variable is typically handled by qmake or \l{#QMAKESPEC}{qmake.conf} and
rarely needs to be modified.
- \target QMAKE_CFLAGS_RELEASE
\section1 QMAKE_CFLAGS_RELEASE
Specifies the C compiler flags for release builds.
The value of this variable is typically handled by qmake or \l{#QMAKESPEC}{qmake.conf}
and rarely needs to be modified.
- \target QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO
\section1 QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO
Specifies the C compiler flags for release builds where
@@ -1951,7 +1931,6 @@
The value of this variable is typically handled by
qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
- \target QMAKE_CFLAGS_SHLIB
\section1 QMAKE_CFLAGS_SHLIB
\note This variable is used on Unix platforms only.
@@ -1961,7 +1940,6 @@
qmake or \l{#QMAKESPEC}{qmake.conf} and rarely
needs to be modified.
- \target QMAKE_CFLAGS_THREAD
\section1 QMAKE_CFLAGS_THREAD
Specifies the compiler flags for creating a multi-threaded
@@ -1969,21 +1947,18 @@
qmake or \l{#QMAKESPEC}{qmake.conf} and rarely
needs to be modified.
- \target QMAKE_CFLAGS_WARN_OFF
\section1 QMAKE_CFLAGS_WARN_OFF
This variable is used only when the \c {warn_off} \l{#CONFIG}{CONFIG} option
is set. The value of this variable is typically handled by qmake or
\l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
- \target QMAKE_CFLAGS_WARN_ON
\section1 QMAKE_CFLAGS_WARN_ON
This variable is used only when the \c {warn_on} \l{#CONFIG}{CONFIG} option
is set. The value of this variable is typically handled by
qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
- \target QMAKE_CLEAN
\section1 QMAKE_CLEAN
Specifies a list of generated files (by \l{moc} and \l{uic}, for example) and
@@ -2005,21 +1980,18 @@
adjusted by modifying the \c QMAKE_CXXFLAGS_DEBUG and
\c QMAKE_CXXFLAGS_RELEASE variables, respectively.
- \target QMAKE_CXXFLAGS_DEBUG
\section1 QMAKE_CXXFLAGS_DEBUG
Specifies the C++ compiler flags for debug builds.
The value of this variable is typically handled by
qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
- \target QMAKE_CXXFLAGS_RELEASE
\section1 QMAKE_CXXFLAGS_RELEASE
Specifies the C++ compiler flags for release builds.
The value of this variable is typically handled by
qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
- \target QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO
\section1 QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO
Specifies the C++ compiler flags for release builds where
@@ -2027,7 +1999,6 @@
The value of this variable is typically handled by
qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
- \target QMAKE_CXXFLAGS_SHLIB
\section1 QMAKE_CXXFLAGS_SHLIB
Specifies the C++ compiler flags for creating a shared library.
@@ -2035,14 +2006,12 @@
qmake or \l{#QMAKESPEC}{qmake.conf} and rarely
needs to be modified.
- \target QMAKE_CXXFLAGS_THREAD
\section1 QMAKE_CXXFLAGS_THREAD
Specifies the C++ compiler flags for creating a multi-threaded application.
The value of this variable is typically handled by qmake or \l{#QMAKESPEC}
{qmake.conf} and rarely needs to be modified.
- \target QMAKE_CXXFLAGS_WARN_OFF
\section1 QMAKE_CXXFLAGS_WARN_OFF
Specifies the C++ compiler flags for suppressing compiler
@@ -2050,7 +2019,6 @@
qmake or \l{#QMAKESPEC}{qmake.conf} and rarely
needs to be modified.
- \target QMAKE_CXXFLAGS_WARN_ON
\section1 QMAKE_CXXFLAGS_WARN_ON
Specifies C++ compiler flags for generating compiler warnings.
@@ -2058,7 +2026,6 @@
qmake or \l{#QMAKESPEC}{qmake.conf} and rarely
needs to be modified.
- \target QMAKE_DEVELOPMENT_TEAM
\section1 QMAKE_DEVELOPMENT_TEAM
\note This variable is used on \macos, iOS, tvOS, and watchOS only.
@@ -2066,12 +2033,10 @@
The identifier of a development team to use for signing certificates
and provisioning profiles.
- \target QMAKE_DISTCLEAN
\section1 QMAKE_DISTCLEAN
Specifies a list of files to be removed by \c{make distclean}.
- \target QMAKE_EXTENSION_SHLIB
\section1 QMAKE_EXTENSION_SHLIB
Contains the extension for shared libraries. The value of
@@ -2081,7 +2046,6 @@
\note Platform-specific variables that change the extension override
the contents of this variable.
- \target QMAKE_EXTENSION_STATICLIB
\section1 QMAKE_EXTENSION_STATICLIB
Contains the extension for shared static libraries. The value of
@@ -2092,51 +2056,51 @@
Contains the extension used on included moc files.
- See also \l{Configuring qmake#Extensions}{File Extensions}.
+ See also \l{Configuring qmake#File Extensions}{File Extensions}.
\section1 QMAKE_EXT_UI
Contains the extension used on \QD UI files.
- See also \l{Configuring qmake#Extensions}{File Extensions}.
+ See also \l{Configuring qmake#File Extensions}{File Extensions}.
\section1 QMAKE_EXT_PRL
Contains the extension used on created PRL files.
- See also \l{Configuring qmake#Extensions}{File Extensions},
- \l{LibDepend}{Library Dependencies}.
+ See also \l{Configuring qmake#File Extensions}{File Extensions},
+ \l{Library Dependencies}.
\section1 QMAKE_EXT_LEX
Contains the extension used on files given to Lex.
- See also \l{Configuring qmake#Extensions}{File Extensions},
+ See also \l{Configuring qmake#File Extensions}{File Extensions},
\l{#LEXSOURCES}{LEXSOURCES}.
\section1 QMAKE_EXT_YACC
Contains the extension used on files given to Yacc.
- See also \l{Configuring qmake#Extensions}{File Extensions},
+ See also \l{Configuring qmake#File Extensions}{File Extensions},
\l{#YACCSOURCES}{YACCSOURCES}.
\section1 QMAKE_EXT_OBJ
Contains the extension used on generated object files.
- See also \l{Configuring qmake#Extensions}{File Extensions}.
+ See also \l{Configuring qmake#File Extensions}{File Extensions}.
\section1 QMAKE_EXT_CPP
Contains suffixes for files that should be interpreted as C++ source code.
- See also \l{Configuring qmake#Extensions}{File Extensions}.
+ See also \l{Configuring qmake#File Extensions}{File Extensions}.
\section1 QMAKE_EXT_H
Contains suffixes for files which should be interpreted as C header files.
- See also \l{Configuring qmake#Extensions}{File Extensions}.
+ See also \l{Configuring qmake#File Extensions}{File Extensions}.
\section1 QMAKE_EXTRA_COMPILERS
@@ -2150,7 +2114,6 @@
See also \l{Adding Custom Targets}.
- \target QMAKE_FAILED_REQUIREMENTS
\section1 QMAKE_FAILED_REQUIREMENTS
Contains the list of failed requirements.
@@ -2171,7 +2134,6 @@
See \l{Creating Frameworks} for
more information about creating frameworks and library bundles.
- \target QMAKE_FRAMEWORK_VERSION
\section1 QMAKE_FRAMEWORK_VERSION
\note This variable is used on \macos, iOS, tvOS, and watchOS only.
@@ -2185,7 +2147,6 @@
See \l{Creating Frameworks} for more information about creating frameworks.
- \target QMAKE_HOST
\section1 QMAKE_HOST
Provides information about the host machine running qmake.
@@ -2204,14 +2165,12 @@
\snippet code/doc_src_qmake-manual.pro 187
- \target QMAKE_INCDIR
\section1 QMAKE_INCDIR
Specifies the list of system header paths that are appended to \l{INCLUDEPATH}.
The value of this variable is typically handled by qmake or
\l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
- \target QMAKE_INCDIR_EGL
\section1 QMAKE_INCDIR_EGL
Specifies the location of EGL header files to be added to
@@ -2220,7 +2179,6 @@
qmake or \l{#QMAKESPEC}{qmake.conf} and rarely
needs to be modified.
- \target QMAKE_INCDIR_OPENGL
\section1 QMAKE_INCDIR_OPENGL
Specifies the location of OpenGL header files to be added
@@ -2244,7 +2202,6 @@
If the OpenGL implementation uses EGL (most OpenGL/ES systems),
then QMAKE_INCDIR_EGL may also need to be set.
- \target QMAKE_INCDIR_OPENVG
\section1 QMAKE_INCDIR_OPENVG
Specifies the location of OpenVG header files to be added
@@ -2256,7 +2213,6 @@
If the OpenVG implementation uses EGL then QMAKE_INCDIR_EGL may also
need to be set.
- \target QMAKE_INCDIR_X11
\section1 QMAKE_INCDIR_X11
\note This variable is used on Unix platforms only.
@@ -2266,7 +2222,6 @@
is typically handled by qmake or
\l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
- \target QMAKE_INFO_PLIST
\section1 QMAKE_INFO_PLIST
\note This variable is used on \macos, iOS, tvOS, and watchOS platforms only.
@@ -2285,8 +2240,11 @@
\li \c ${PRODUCT_BUNDLE_IDENTIFIER}, \c @BUNDLEIDENTIFIER@
\li Expands to the target bundle's bundle identifier string,
for example: \c{com.example.myapp}. Determined by concatenating the
- values of QMAKE_TARGET_BUNDLE_PREFIX and QMAKE_BUNDLE, separated
- by a full stop (\c{.}).
+ values of \c QMAKE_TARGET_BUNDLE_PREFIX and \c QMAKE_BUNDLE, separated
+ by a full stop (\c{.}). The value of \c QMAKE_BUNDLE is derived from
+ \c QMAKE_APPLICATION_BUNDLE_NAME, \c QMAKE_PLUGIN_BUNDLE_NAME, or
+ \c QMAKE_FRAMEWORK_BUNDLE_NAME. It should not be set directly by the
+ project.
\row
\li \c ${EXECUTABLE_NAME}, \c @EXECUTABLE@, \c @LIBRARY@
\li Equivalent to the value of QMAKE_APPLICATION_BUNDLE_NAME,
@@ -2357,7 +2315,6 @@
platform or type of project, use one of the specialized variables
for that purpose instead of this variable.
- \target QMAKE_LFLAGS_CONSOLE
\section1 QMAKE_LFLAGS_CONSOLE
\note This variable is used on Windows only.
@@ -2625,7 +2582,6 @@
value of this variable is typically handled by qmake or
\l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
- \target QMAKE_LRELEASE_FLAGS
\section1 QMAKE_LRELEASE_FLAGS
List of additional options passed to \l{Using lrelease}{lrelease} when
@@ -2651,7 +2607,8 @@
together. This variable is normally empty and therefore nothing is
executed.
- \note This variable takes no effect on Xcode projects.
+ \warning This variable is not supported when using the Xcode
+ generator and the new Xcode build system.
\section1 QMAKE_PROJECT_NAME
@@ -2661,7 +2618,6 @@
files for IDEs. The default value is the target name. The value of this
variable is typically handled by qmake and rarely needs to be modified.
- \target QMAKE_PROVISIONING_PROFILE
\section1 QMAKE_PROVISIONING_PROFILE
\note This variable is used on \macos, iOS, tvOS, and watchOS only.
@@ -2794,7 +2750,6 @@
variable is typically handled by qmake or
\l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
- \target QMAKE_TARGET_COMPANY
\section1 QMAKE_TARGET_COMPANY
Windows only. Specifies the company for the project target; this is
@@ -2802,7 +2757,6 @@
properties. This is only utilized if the \l{VERSION} or \l{RC_ICONS}
variable is set and the \l{RC_FILE} and \l{RES_FILE} variables are not set.
- \target QMAKE_TARGET_DESCRIPTION
\section1 QMAKE_TARGET_DESCRIPTION
Windows only. Specifies the description for the project target; this is
@@ -2810,7 +2764,6 @@
properties. This is only utilized if the \l{VERSION} or \l{RC_ICONS}
variable is set and the \l{RC_FILE} and \l{RES_FILE} variables are not set.
- \target QMAKE_TARGET_COPYRIGHT
\section1 QMAKE_TARGET_COPYRIGHT
Windows only. Specifies the copyright information for the project target;
@@ -2819,7 +2772,6 @@
\l{RC_ICONS} variable is set and the \l{RC_FILE} and \l{RES_FILE} variables
are not set.
- \target QMAKE_TARGET_PRODUCT
\section1 QMAKE_TARGET_PRODUCT
Windows only. Specifies the product for the project target; this is used
@@ -2827,7 +2779,6 @@
This is only utilized if the \l{VERSION} or \l{RC_ICONS} variable is set
and the \l{RC_FILE} and \l{RES_FILE} variables are not set.
- \target QMAKE_TARGET_ORIGINAL_FILENAME
\section1 QMAKE_TARGET_ORIGINAL_FILENAME
Windows only. Specifies the original file name for the project target;
@@ -2836,7 +2787,6 @@
\l{RC_ICONS} variable is set and the \l{RC_FILE} and \l{RES_FILE}
variables are not set.
- \target QMAKE_TARGET_INTERNALNAME
\section1 QMAKE_TARGET_INTERNALNAME
Windows only. Specifies the internal name for the project target; this is
@@ -2844,7 +2794,6 @@
properties. This is only utilized if the \l{VERSION} or \l{RC_ICONS}
variable is set and the \l{RC_FILE} and \l{RES_FILE} variables are not set.
- \target QMAKE_TARGET_COMMENTS
\section1 QMAKE_TARGET_COMMENTS
Windows only. Specifies the comments for the project target; this is
@@ -2852,7 +2801,6 @@
properties. This is only utilized if the \l{VERSION} or \l{RC_ICONS}
variable is set and the \l{RC_FILE} and \l{RES_FILE} variables are not set.
- \target QMAKE_TARGET_TRADEMARKS
\section1 QMAKE_TARGET_TRADEMARKS
Windows only. Specifies the trademark information for the project target;
@@ -2861,7 +2809,6 @@
\l{RC_ICONS} variable is set and the \l{RC_FILE} and \l{RES_FILE} variables
are not set.
- \target QMAKE_MANIFEST
\section1 QMAKE_MANIFEST
Windows only. Specifies the manifest file for the project target.
@@ -2962,22 +2909,18 @@
shared/dynamic build of Qt, or when linking libraries.
It may be used for deployment of dynamic plugins at a later time.
- \target QT_VERSION_variable
\section1 QT_VERSION
Contains the current version of Qt.
- \target QT_MAJOR_VERSION
\section1 QT_MAJOR_VERSION
Contains the current major version of Qt.
- \target QT_MINOR_VERSION
\section1 QT_MINOR_VERSION
Contains the current minor version of Qt.
- \target QT_PATCH_VERSION
\section1 QT_PATCH_VERSION
Contains the current patch version of Qt.
@@ -2987,14 +2930,12 @@
Windows only. Specifies the name of the Windows resource file (.rc) for the
target. See \l{Adding Windows Resource Files}.
- \target RC_CODEPAGE
\section1 RC_CODEPAGE
Windows only. Specifies the codepage that should be specified in a generated
.rc file. This is only utilized if the \l{VERSION} or \l{RC_ICONS} variable
is set and the \l{RC_FILE} and \l{RES_FILE} variables are not set.
- \target RC_DEFINES
\section1 RC_DEFINES
Windows only. qmake adds the values of this variable as RC preprocessor macros
@@ -3002,7 +2943,6 @@
\snippet code/doc_src_qmake-manual.pro 186
- \target RC_ICONS
\section1 RC_ICONS
Windows only. Specifies the icons that should be included into a generated
@@ -3010,7 +2950,6 @@
are not set. More details about the generation of .rc files can be found in
the \l{Platform Notes}.
- \target RC_LANG
\section1 RC_LANG
Windows only. Specifies the language that should be specified in a generated
@@ -3021,7 +2960,6 @@
Specifies include paths that are passed to the Windows Resource Compiler.
- \target RCC_DIR
\section1 RCC_DIR
Specifies the directory for Qt Resource Compiler output files.
@@ -3030,7 +2968,6 @@
\snippet code/doc_src_qmake-manual.pro 48
- \target REQUIRES
\section1 REQUIRES
Specifies a list of values that are evaluated as conditions. If any of the conditions is false,
@@ -3039,7 +2976,6 @@
\note We recommend using the \l{requires(condition)}{requires()} function
instead if you want to skip projects or subprojects when building.
- \target RESOURCES
\section1 RESOURCES
Specifies the name of the resource collection files (qrc)
@@ -3055,7 +2991,6 @@
qmake or \l{#QMAKESPEC}{qmake.conf} and rarely
needs to be modified.
- \target SOURCES
\section1 SOURCES
Specifies the names of all source files in the project.
@@ -3066,7 +3001,6 @@
See also \l{#HEADERS}{HEADERS}.
- \target SUBDIRS
\section1 SUBDIRS
This variable, when used with the \c subdirs \l{#TEMPLATE}{template}
@@ -3128,7 +3062,6 @@
\snippet code/doc_src_qmake-manual.pro 149
- \target TARGET
\section1 TARGET
Specifies the name of the target file. Contains the base name of the project
@@ -3161,7 +3094,6 @@
qmake or \l{#QMAKESPEC}{qmake.conf} and rarely
needs to be modified.
- \target TEMPLATE
\section1 TEMPLATE
Specifies the name of the template to use when generating the project. The
@@ -3198,7 +3130,6 @@
determine how the project is built, it is necessary to declare TEMPLATE on
the command line rather than use the \c -t option.
- \target TRANSLATIONS
\section1 TRANSLATIONS
Specifies a list of translation (.ts) files that contain
@@ -3216,7 +3147,25 @@
See the \l{Qt Linguist Manual} for more information about
internationalization (i18n) and localization (l10n) with Qt.
- \target UI_DIR
+ \section1 TR_EXCLUDE
+
+ Specifies a list of paths (source files, subdirectories, and C++ include
+ paths) to be excluded from handling in \c{lupdate}. The paths may contain
+ wildcards. Relative paths are considered to be relative to
+ \l{_PRO_FILE_PWD_}.
+
+ For example, to exclude source files:
+
+ \snippet code/doc_src_qmake-manual.pro TR_EXCLUDE sources
+
+ To exclude subdirectories of a \c SUBDIRS project:
+
+ \snippet code/doc_src_qmake-manual.pro TR_EXCLUDE SUBDIRS
+
+ To speed up lupdate's C++ parser, exclude include paths:
+
+ \snippet code/doc_src_qmake-manual.pro TR_EXCLUDE include paths
+
\section1 UI_DIR
Specifies the directory where all intermediate files from uic
@@ -3226,7 +3175,6 @@
\snippet code/doc_src_qmake-manual.pro 54
- \target VERSION
\section1 VERSION
Specifies the version number of the application if the \c app
@@ -3277,7 +3225,6 @@
See also \l{#DEPENDPATH}{DEPENDPATH}.
- \target WINDOWS_TARGET_PLATFORM_VERSION
\section1 WINDOWS_TARGET_PLATFORM_VERSION
Specifies the targeted Windows version; this corresponds to the tag
@@ -3286,7 +3233,6 @@
On desktop Windows, the default value is the value of the environment
variable \c{WindowsSDKVersion}.
- \target WINDOWS_TARGET_PLATFORM_MIN_VERSION
\section1 WINDOWS_TARGET_PLATFORM_MIN_VERSION
Specifies the minimum version of the Windows target platform; this
@@ -3294,7 +3240,6 @@
Defaults to \c{WINDOWS_TARGET_PLATFORM_VERSION}.
- \target YACCSOURCES
\section1 YACCSOURCES
Specifies a list of Yacc source files to be included
@@ -3374,7 +3319,6 @@
\snippet code/doc_src_qmake-manual.pro 59
- \target qmake-cat
\section2 cat(filename[, mode])
Returns the contents of \c filename. You can specify the following options
@@ -3426,7 +3370,6 @@
\snippet code/doc_src_qmake-manual.pro 173
- \target findfunction
\section2 find(variablename, substr)
Returns all the values in \c variablename that match the regular expression
@@ -3442,7 +3385,6 @@
Expands the specified wildcard pattern and returns a list of filenames.
If \c recursive is true, this function descends into subdirectories.
- \target fn_first
\section2 first(variablename)
Returns the first value of \c variablename.
@@ -3451,9 +3393,9 @@
\snippet code/doc_src_qmake-manual.pro 161
- See also \l{take_first()}, \l{fn_last}{last()}.
+ See also \l{take_first(variablename)}{take_first()},
+ \l{last(variablename)}{last()}.
- \target format_number()
\section2 format_number(number[, options...])
Returns \c number in the format specified by \c options. You can specify the
@@ -3504,7 +3446,6 @@
to empty strings. If you need to encode spaces in \c glue, \c before, or \c
after, you must quote them.
- \target fn_last
\section2 last(variablename)
Returns the last value of \c variablename.
@@ -3513,7 +3454,8 @@
\snippet code/doc_src_qmake-manual.pro 162
- See also \l{take_last()}, \l{fn_first}{first()}.
+ See also \l{take_last(variablename)}{take_last()},
+ \l{first(variablename)}{first()}.
\section2 list(arg1 [, arg2 ..., argn])
@@ -3534,7 +3476,6 @@
See also \l{upper(arg1 [, arg2 ..., argn])}{upper()}.
- \target member()
\section2 member(variablename [, start [, end]])
Returns the slice of the list value of \c variablename with the
@@ -3561,9 +3502,8 @@
that an empty list will be returned only when an index is invalid
(which is implied by the input variable being empty).
- See also \l{str_member()}.
+ See also \l{str_member(arg [, start [, end]])}{str_member()}.
- \target num_add()
\section2 num_add(arg1 [, arg2 ..., argn])
Takes an arbitrary number of numeric arguments and adds them up,
@@ -3695,12 +3635,11 @@
See also \l{system_quote(arg)}{system_quote()}.
- \target fn_size
\section2 size(variablename)
Returns the number of values of \c variablename.
- See also \l{str_size()}.
+ See also \l{str_size(arg)}{str_size()}.
\section2 sort_depends(variablename, prefix)
@@ -3714,7 +3653,8 @@
in ascending ASCII order.
Numerical sorting can be accomplished by zero-padding the values to
- a fixed length with the help of the \l{format_number()} function.
+ a fixed length with the help of the
+ \l{format_number(number[, options...])}{format_number()} function.
This function was introduced in Qt 5.8.
@@ -3732,12 +3672,11 @@
Replaces %1-%9 in \c string with the arguments passed in the comma-separated
list of function \c arguments and returns the processed string.
- \target str_member()
\section2 str_member(arg [, start [, end]])
- This function is identical to \l{member()}, except that it operates
- on a string value instead of a list variable, and consequently the
- indices refer to character positions.
+ This function is identical to \l{member(variablename [, start [, end]])}
+ {member()}, except that it operates on a string value instead of a list
+ variable, and consequently the indices refer to character positions.
This function can be used to implement many common string slicing
operations:
@@ -3762,20 +3701,19 @@
\note In these implementations, a zero \c len argument needs to be
handled separately.
- See also \l{member()}, \l{num_add()}.
+ See also \l{member(variablename [, start [, end]])}{member()},
+ \l{num_add(arg1 [, arg2 ..., argn])}{num_add()}.
This function was introduced in Qt 5.8.
- \target str_size()
\section2 str_size(arg)
Returns the number of characters in the argument.
- See also \l{fn_size}{size()}.
+ See also \l{size(variablename)}{size()}.
This function was introduced in Qt 5.8.
- \target system_replace
\section2 system(command[, mode[, stsvar]])
You can use this variant of the \c system function to obtain stdout from the
@@ -3785,9 +3723,10 @@
\snippet code/doc_src_qmake-manual.pro 72
- Like \l {qmake-cat}{$$cat()}, the \a mode argument takes \c blob, \c lines,
- \c true, and \c false as value. However, the legacy word splitting rules
- (i.e. empty or \c true, and \c false) differ subtly.
+ Like \l {cat(filename[, mode])}{$$cat()}, the \a mode argument takes
+ \c blob, \c lines, \c true, and \c false as value. However, the legacy
+ word splitting rules (i.e. empty or \c true, and \c false) differ
+ subtly.
If you pass \c stsvar, the command's exit status will be stored in that
variable. If the command crashes, the status will be -1, otherwise a
@@ -3816,7 +3755,6 @@
See also \l{shell_quote(arg)}{shell_quote()}.
- \target take_first()
\section2 take_first(variablename)
Returns the first value of \c variablename and removes it from the
@@ -3826,9 +3764,9 @@
This function was introduced in Qt 5.8.
- See also \l{take_last()}, \l{fn_first}{first()}.
+ See also \l{take_last(variablename)}{take_last()},
+ \l{first(variablename)}{first()}.
- \target take_last()
\section2 take_last(variablename)
Returns the last value of \c variablename and removes it from the
@@ -3838,9 +3776,9 @@
This function was introduced in Qt 5.8.
- See also \l{take_first()}, \l{fn_last}{last()}.
+ See also \l{take_first(variablename)}{take_first()},
+ \l{last(variablename)}{last()}.
- \target unique
\section2 unique(variablename)
Returns the list of values in \c variablename with duplicate entries removed.
@@ -3918,7 +3856,6 @@
appropriate files are added to the \l{SOURCES} and \l{HEADERS}
variables.
- \target countfunction
\section2 count(variablename, number)
Succeeds if the variable \c variablename contains a list with the
@@ -3997,7 +3934,6 @@
Exports the current value of \c variablename from the local context of a
function to the global context.
- \target forfunction
\section2 for(iterate, list)
Starts a loop that iterates over all values in \c list, setting \c iterate to each
@@ -4008,6 +3944,10 @@
\snippet code/doc_src_qmake-manual.pro 65
+ Loops can be interrupted with \c{break()}. The \c{next()} statement skips
+ the remainder of the loop's body and continues execution with the next
+ iteration.
+
\section2 greaterThan(variablename, value)
Tests that the value of \c variablename is greater than \c value. First,
@@ -4138,9 +4078,9 @@
\snippet code/doc_src_qmake-manual.pro 71
- See also the replace variant of \l{system_replace}{system()}.
+ See also the replace variant of \l{system(command[, mode[, stsvar]])}
+ {system()}.
- \target touchfunction
\section2 touch(filename, reference_filename)
Updates the time stamp of \c filename to match the time stamp of
@@ -4359,7 +4299,6 @@
\snippet code/doc_src_qmake-manual.pro 78
- \target QMAKESPEC
\section1 QMAKESPEC
qmake requires a platform and compiler
@@ -4383,7 +4322,6 @@
\note The \c QMAKESPEC path will be automatically added to the generated
Makefile after the contents of the \l{INCLUDEPATH} system variable.
- \target cache
\section1 Cache File
The cache file is a special file qmake reads to
@@ -4396,7 +4334,6 @@
If qmake finds a \c{.qmake.cache} file then it will process this file first before
it processes the project file.
- \target Extensions
\section1 File Extensions
Under normal circumstances qmake will try to
@@ -4417,7 +4354,7 @@
\li \l{QMAKE_EXT_UI} modifies the extension used for \QD UI files
(usually in \l{FORMS}).
\li \l{QMAKE_EXT_PRL} modifies the extension placed on
- \l{LibDepend}{library dependency files}.
+ \l{Library Dependencies}{library dependency files}.
\li \l{QMAKE_EXT_LEX} changes the suffix used in Lex files (usually in
\l{LEXSOURCES}).
\li \l{QMAKE_EXT_YACC} changes the suffix used in Yacc files (usually in
@@ -4498,8 +4435,8 @@
\snippet code/doc_src_qmake-manual.pro 92
In the above line, \c USE_MY_STUFF will only be added to the list of pre-processor
- defines if it is not already defined. Note that the \l{unique}{unique()}
- function can also be used to ensure that a variable only contains one
+ defines if it is not already defined. Note that the \l{unique(variablename)}
+ {unique()} function can also be used to ensure that a variable only contains one
instance of each value.
\section2 Replacing Values
@@ -4558,7 +4495,6 @@
\snippet code/doc_src_qmake-manual.pro 101
- \target Scopes
\section1 Scopes
Scopes are similar to \c if statements in procedural programming languages.
@@ -4685,7 +4621,6 @@
You can test for any other platform-compiler combination as long as a
specification exists for it in the \c mkspecs directory.
- \target UsingVariables
\section1 Variables
Many of the variables used in project files are special variables that
@@ -4718,7 +4653,6 @@
\snippet code/doc_src_qmake-manual.pro 100
- \target UsingReplaceFunctions
\section1 Replace Functions
qmake provides a selection of built-in
@@ -4744,7 +4678,6 @@
\snippet qmake/replacefunction.pro 0
- \target UsingTestFunctions
\section1 Test Functions
qmake provides built-in functions that can be
@@ -5063,7 +4996,6 @@
to be linked in.
\endtable
- \target LibDepend
\section1 Library Dependencies
Often when linking against a library, qmake
@@ -5117,7 +5049,6 @@
\previouspage Advanced Usage
\nextpage Configuring qmake
- \target Introduction
Precompiled headers (PCH) are a performance feature supported by some
compilers to compile a stable body of code, and store the compiled
@@ -5146,7 +5077,6 @@
\endlist
\endlist
- \target ADD_PCH
\section1 Adding Precompiled Headers to Your Project
The precompiled header must contain code which is \e stable
@@ -5159,7 +5089,6 @@
C++ includes, since the precompiled header file for C files may not
contain C++ code.
- \target PROJECT_OPTIONS
\section2 Project Options
To make your project use precompiled headers, you only need to define the
@@ -5199,7 +5128,6 @@
To avoid potential conflicts like these, give distinctive names to header
files that will be precompiled.
- \target EXAMPLE_PROJECT
\section1 Example Project
You can find the following source code in the
@@ -5513,7 +5441,6 @@
Platform-specific variables are not described here. For more information,
see \l{Qt for Windows - Deployment} and \l{Qt for macOS}.
- \target Application
\section1 Building an Application
The \c app template tells qmake to generate a
@@ -5539,7 +5466,7 @@
\li \l{HEADERS} - A list of header files for the application.
\li \l{SOURCES} - A list of C++ source files for the application.
\li \l{FORMS} - A list of UI files for the application (created using
- Qt Designer).
+ \QD).
\li \l{LEXSOURCES} - A list of Lex source files for the application.
\li \l{YACCSOURCES} - A list of Yacc source files for the
application.
@@ -5633,7 +5560,6 @@
The only primary requirement is that the test program exit with a zero exit code
on success, and a non-zero exit code on failure.
- \target Library
\section1 Building a Library
The \c lib template tells qmake to generate a Makefile that will build a
@@ -5662,7 +5588,6 @@
X11, \macos, and iOS, the library name will be prefixed by \c lib. On Windows,
no prefix is added to the file name.
- \target Plugin
\section1 Building a Plugin
Plugins are built using the \c lib template, as described in the previous
@@ -5676,7 +5601,7 @@
\li VERSION - The version number of the target library. For example, 2.3.1.
\endlist
- \section2 Building a Qt Designer Plugin
+ \section2 Building a Qt Widgets Designer Plugin
\QD plugins are built using a specific set of configuration settings that
depend on the way Qt was configured for your system. For convenience, these
@@ -5687,7 +5612,8 @@
QT += widgets designer
\endcode
- See the \l{Qt Designer Examples} for more examples of plugin-based projects.
+ See the \l{Qt Widgets Designer Examples} for more examples of plugin-based
+ projects.
\section1 Building and Installing in Debug and Release Modes
diff --git a/qmake/generators/mac/pbuilder_pbx.cpp b/qmake/generators/mac/pbuilder_pbx.cpp
index f03dce2bc4..d0d560aca9 100644
--- a/qmake/generators/mac/pbuilder_pbx.cpp
+++ b/qmake/generators/mac/pbuilder_pbx.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** 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) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "pbuilder_pbx.h"
#include "option.h"
@@ -112,7 +87,7 @@ ProjectBuilderMakefileGenerator::writeSubDirs(QTextStream &t)
for(int pb_subdir = 0; pb_subdir < pb_subdirs.size(); ++pb_subdir) {
ProjectBuilderSubDirs *pb = pb_subdirs[pb_subdir];
const ProStringList &subdirs = pb->project->values("SUBDIRS");
- for(int subdir = 0; subdir < subdirs.count(); subdir++) {
+ for(int subdir = 0; subdir < subdirs.size(); subdir++) {
ProString tmpk = subdirs[subdir];
const ProKey fkey(tmpk + ".file");
if (!pb->project->isEmpty(fkey)) {
@@ -354,7 +329,7 @@ ProjectBuilderMakefileGenerator::writeSubDirs(QTextStream &t)
t << "\t\t\tprojectReferences = (\n";
{
const ProStringList &qmake_subdirs = project->values("QMAKE_PBX_SUBDIRS");
- for(int i = 0; i < qmake_subdirs.count(); i++) {
+ for(int i = 0; i < qmake_subdirs.size(); i++) {
const ProString &subdir = qmake_subdirs[i];
t << "\t\t\t\t{\n"
<< "\t\t\t\t\t" << writeSettings("ProductGroup", keyFor(subdir + "_PRODUCTGROUP")) << ";\n"
@@ -454,17 +429,17 @@ ProjectBuilderSources::files(QMakeProject *project) const
static QString xcodeFiletypeForFilename(const QString &filename)
{
- for (const QString &ext : qAsConst(Option::cpp_ext)) {
+ for (const QString &ext : std::as_const(Option::cpp_ext)) {
if (filename.endsWith(ext))
return QStringLiteral("sourcecode.cpp.cpp");
}
- for (const QString &ext : qAsConst(Option::c_ext)) {
+ for (const QString &ext : std::as_const(Option::c_ext)) {
if (filename.endsWith(ext))
return QStringLiteral("sourcecode.c.c");
}
- for (const QString &ext : qAsConst(Option::h_ext)) {
+ for (const QString &ext : std::as_const(Option::h_ext)) {
if (filename.endsWith(ext))
return "sourcecode.c.h";
}
@@ -549,14 +524,14 @@ bool ProjectBuilderMakefileGenerator::replaceLibrarySuffix(const QString &lib_fi
warn_msg(WarnLogic, "Failed to find expected suffix '%s' for library '%s'.",
qPrintable(librarySuffix), qPrintable(library));
} else {
- library.replace(pos, librarySuffix.length(), suffixSetting);
+ library.replace(pos, librarySuffix.size(), suffixSetting);
if (name.endsWith(librarySuffix))
- name.chop(librarySuffix.length());
+ name.chop(librarySuffix.size());
}
} else {
int pos = library.lastIndexOf(name);
if (pos != -1)
- library.insert(pos + name.length(), suffixSetting);
+ library.insert(pos + name.size(), suffixSetting);
}
}
}
@@ -683,7 +658,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
const QStringList &files = fileFixify(sources.at(source).files(project),
FileFixifyFromOutdir | FileFixifyAbsolute);
- for(int f = 0; f < files.count(); ++f) {
+ for(int f = 0; f < files.size(); ++f) {
QString file = files[f];
if(!sources.at(source).compilerName().isNull() &&
!verifyExtraCompiler(sources.at(source).compilerName(), file))
@@ -873,6 +848,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
<< "\t\t\t" << writeSettings("shellScript", "make -C " + IoUtils::shellQuoteUnix(Option::output_dir)
+ " -f " + IoUtils::shellQuoteUnix(mkfile)) << ";\n"
<< "\t\t\t" << writeSettings("showEnvVarsInLog", "0") << ";\n"
+ << "\t\t\t" << writeSettings("alwaysOutOfDate", "1") << ";\n"
<< "\t\t};\n";
}
@@ -897,7 +873,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
"QMAKE_LIBS", "QMAKE_LIBS_PRIVATE", nullptr };
for (int i = 0; libs[i]; i++) {
tmp = project->values(libs[i]);
- for(int x = 0; x < tmp.count();) {
+ for(int x = 0; x < tmp.size();) {
bool libSuffixReplaced = false;
bool remove = false;
QString library, name;
@@ -936,7 +912,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
if(opt.size() > 2) {
r = opt.mid(2).toQString();
} else {
- if(x == tmp.count()-1)
+ if(x == tmp.size()-1)
break;
r = tmp[++x].toQString();
}
@@ -945,12 +921,12 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
frameworkdirs.append(r);
}
} else if(opt == "-framework") {
- if(x == tmp.count()-1)
+ if(x == tmp.size()-1)
break;
const ProString &framework = tmp[x+1];
ProStringList fdirs = frameworkdirs;
fdirs << "/System/Library/Frameworks/" << "/Library/Frameworks/";
- for(int fdir = 0; fdir < fdirs.count(); fdir++) {
+ for(int fdir = 0; fdir < fdirs.size(); fdir++) {
if(exists(fdirs[fdir] + QDir::separator() + framework + ".framework")) {
remove = true;
library = fdirs[fdir] + Option::dir_sep + framework + ".framework";
@@ -979,7 +955,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
const int slsh = library.lastIndexOf(Option::dir_sep);
if(name.isEmpty()) {
if(slsh != -1)
- name = library.right(library.length() - slsh - 1);
+ name = library.right(library.size() - slsh - 1);
}
if(slsh != -1) {
const QString path = QFileInfo(library.left(slsh)).absoluteFilePath();
@@ -1032,12 +1008,12 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
mkt << "SUBLIBS= ";
// ### This is missing the parametrization found in unixmake2.cpp
tmp = project->values("SUBLIBS");
- for(int i = 0; i < tmp.count(); i++)
+ for(int i = 0; i < tmp.size(); i++)
t << escapeFilePath("tmp/lib" + tmp[i] + ".a") << ' ';
t << Qt::endl << Qt::endl;
mkt << "sublibs: $(SUBLIBS)\n\n";
tmp = project->values("SUBLIBS");
- for(int i = 0; i < tmp.count(); i++)
+ for(int i = 0; i < tmp.size(); i++)
t << escapeFilePath("tmp/lib" + tmp[i] + ".a") + ":\n\t"
<< var(ProKey("MAKELIB" + tmp[i])) << Qt::endl << Qt::endl;
mkt.flush();
@@ -1172,7 +1148,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
//all bundle data
const ProStringList &bundle_data = project->values("QMAKE_BUNDLE_DATA");
- for(int i = 0; i < bundle_data.count(); i++) {
+ for(int i = 0; i < bundle_data.size(); i++) {
ProStringList bundle_files;
ProString path = project->first(ProKey(bundle_data[i] + ".path"));
const bool isEmbeddedFramework = ((!osx && path == QLatin1String("Frameworks"))
@@ -1182,7 +1158,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
//all files
const ProStringList &files = project->values(ProKey(bundle_data[i] + ".files"));
- for(int file = 0; file < files.count(); file++) {
+ for(int file = 0; file < files.size(); file++) {
QString fn = fileFixify(files[file].toQString(), FileFixifyAbsolute);
QString name = fn.split(Option::dir_sep).back();
QString file_ref_key = keyFor("QMAKE_PBX_BUNDLE_DATA_FILE_REF." + bundle_data[i] + "-" + fn);
@@ -1205,13 +1181,13 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
if (copyBundleResources && ((!osx && path.isEmpty())
|| (osx && path == QLatin1String("Contents/Resources")))) {
- for (const ProString &s : qAsConst(bundle_files))
+ for (const ProString &s : std::as_const(bundle_files))
bundle_resources_files << s;
} else if (copyBundleResources && isEmbeddedFramework) {
- for (const ProString &s : qAsConst(bundle_files))
+ for (const ProString &s : std::as_const(bundle_files))
embedded_frameworks << s;
} else if (copyBundleResources && isEmbeddedPlugin) {
- for (const ProString &s : qAsConst(bundle_files)) {
+ for (const ProString &s : std::as_const(bundle_files)) {
ProString subpath = (path == pluginsPrefix) ? ProString() : path.mid(pluginsPrefix.size() + 1);
embedded_plugins[subpath] << s;
}
@@ -1708,7 +1684,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
t << "\t\t\t\t" << writeSettings("CODE_SIGN_IDENTITY", project->first("QMAKE_XCODE_CODE_SIGN_IDENTITY")) << ";\n";
tmp = project->values("QMAKE_PBX_VARS");
- for (int i = 0; i < tmp.count(); i++) {
+ for (int i = 0; i < tmp.size(); i++) {
QString var = tmp[i].toQString(), val = QString::fromLocal8Bit(qgetenv(var.toLatin1().constData()));
if (val.isEmpty() && var == "TB")
val = "/usr/bin/";
@@ -1912,7 +1888,7 @@ ProStringList
ProjectBuilderMakefileGenerator::fixListForOutput(const ProStringList &l)
{
ProStringList ret;
- for(int i = 0; i < l.count(); i++)
+ for(int i = 0; i < l.size(); i++)
ret += fixForOutput(l[i].toQString());
return ret;
}
@@ -1994,14 +1970,14 @@ ProjectBuilderMakefileGenerator::pbxbuild()
static QString quotedStringLiteral(const QString &value)
{
QString result;
- const int len = value.length();
+ const int len = value.size();
result.reserve(int(len * 1.1) + 2);
result += QLatin1Char('"');
// Escape
for (int i = 0; i < len; ++i) {
- QChar character = value.at(i);;
+ QChar character = value.at(i);
ushort code = character.unicode();
switch (code) {
case '\\':
diff --git a/qmake/generators/mac/pbuilder_pbx.h b/qmake/generators/mac/pbuilder_pbx.h
index 10a390ec7f..681544971a 100644
--- a/qmake/generators/mac/pbuilder_pbx.h
+++ b/qmake/generators/mac/pbuilder_pbx.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** 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) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef PBUILDER_PBX_H
#define PBUILDER_PBX_H
diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp
index 5a17a92425..482ef2e269 100644
--- a/qmake/generators/makefile.cpp
+++ b/qmake/generators/makefile.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** 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) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "makefile.h"
#include "option.h"
@@ -41,6 +16,7 @@
#include <qdebug.h>
#include <qbuffer.h>
#include <qdatetime.h>
+#include <qtversion.h>
#if defined(Q_OS_UNIX)
#include <unistd.h>
@@ -63,7 +39,7 @@ using namespace QMakeInternal;
bool MakefileGenerator::canExecute(const QStringList &cmdline, int *a) const
{
int argv0 = -1;
- for(int i = 0; i < cmdline.count(); ++i) {
+ for(int i = 0; i < cmdline.size(); ++i) {
if(!cmdline.at(i).contains('=')) {
argv0 = i;
break;
@@ -137,7 +113,7 @@ MakefileGenerator::initOutPaths()
if(!fi.makeAbsolute()) {
QString cache_r = fi.path(), pwd = Option::output_dir;
if(pwd.startsWith(cache_r) && !pwd.startsWith(root)) {
- pwd = root + pwd.mid(cache_r.length());
+ pwd = root + pwd.mid(cache_r.size());
if(exists(pwd))
v.insert("QMAKE_ABSOLUTE_SOURCE_PATH", ProStringList(pwd));
}
@@ -262,7 +238,7 @@ MakefileGenerator::findFilesInVPATH(ProStringList l, uchar flags, const QString
{
ProStringList vpath;
const ProValueMap &v = project->variables();
- for(int val_it = 0; val_it < l.count(); ) {
+ for(int val_it = 0; val_it < l.size(); ) {
bool remove_file = false;
ProString &val = l[val_it];
if(!val.isEmpty()) {
@@ -312,23 +288,23 @@ MakefileGenerator::findFilesInVPATH(ProStringList l, uchar flags, const QString
real_dir = dir;
if(!(flags & VPATH_NoFixify))
real_dir = fileFixify(real_dir, FileFixifyBackwards) + '/';
- regex.remove(0, dir.length());
+ regex.remove(0, dir.size());
}
if(real_dir.isEmpty() || exists(real_dir)) {
QStringList files = QDir(real_dir).entryList(QStringList(regex),
QDir::NoDotAndDotDot | QDir::AllEntries);
if(files.isEmpty()) {
- debug_msg(1, "%s:%d Failure to find %s in vpath (%s)",
- __FILE__, __LINE__, val.toLatin1().constData(),
+ debug_msg(1, "makefile.cpp:%d Failure to find %s in vpath (%s)",
+ __LINE__, val.toLatin1().constData(),
vpath.join(QString("::")).toLatin1().constData());
- if(flags & VPATH_RemoveMissingFiles)
+ if (flags & VPATH_RemoveMissingFiles)
remove_file = true;
- else if(flags & VPATH_WarnMissingFiles)
+ if (flags & VPATH_WarnMissingFiles)
warn_msg(WarnLogic, "Failure to find: %s", val.toLatin1().constData());
} else {
l.removeAt(val_it);
QString a;
- for(int i = (int)files.count()-1; i >= 0; i--) {
+ for(int i = (int)files.size()-1; i >= 0; i--) {
a = real_dir + files[i];
if(!(flags & VPATH_NoFixify))
a = fileFixify(a);
@@ -336,12 +312,12 @@ MakefileGenerator::findFilesInVPATH(ProStringList l, uchar flags, const QString
}
}
} else {
- debug_msg(1, "%s:%d Cannot match %s%s, as %s does not exist.",
- __FILE__, __LINE__, real_dir.toLatin1().constData(),
+ debug_msg(1, "makefile.cpp:%d Cannot match %s%s, as %s does not exist.",
+ __LINE__, real_dir.toLatin1().constData(),
regex.toLatin1().constData(), real_dir.toLatin1().constData());
- if(flags & VPATH_RemoveMissingFiles)
+ if (flags & VPATH_RemoveMissingFiles)
remove_file = true;
- else if(flags & VPATH_WarnMissingFiles)
+ if (flags & VPATH_WarnMissingFiles)
warn_msg(WarnLogic, "Failure to find: %s", val.toLatin1().constData());
}
}
@@ -362,9 +338,14 @@ MakefileGenerator::initCompiler(const MakefileGenerator::Compiler &comp)
// find all the relevant file inputs
if(!init_compiler_already.contains(comp.variable_in)) {
init_compiler_already.insert(comp.variable_in, true);
- if(!noIO())
- l = findFilesInVPATH(l, (comp.flags & Compiler::CompilerRemoveNoExist) ?
- VPATH_RemoveMissingFiles : VPATH_WarnMissingFiles, "VPATH_" + comp.variable_in);
+ if(!noIO()) {
+ uchar flags = 0;
+ if (comp.flags & Compiler::CompilerRemoveNoExist)
+ flags |= VPATH_RemoveMissingFiles;
+ if (comp.flags & Compiler::CompilerWarnNoExist)
+ flags |= VPATH_WarnMissingFiles;
+ l = findFilesInVPATH(l, flags, "VPATH_" + comp.variable_in);
+ }
}
}
@@ -492,12 +473,12 @@ MakefileGenerator::init()
continue;
}
const ProStringList &tinn = v[innkey], &toutn = v[outnkey];
- if (tinn.length() != 1) {
+ if (tinn.size() != 1) {
warn_msg(WarnLogic, "Substitute '%s.input' does not have exactly one value",
sub.toLatin1().constData());
continue;
}
- if (toutn.length() != 1) {
+ if (toutn.size() != 1) {
warn_msg(WarnLogic, "Substitute '%s.output' does not have exactly one value",
sub.toLatin1().constData());
continue;
@@ -515,7 +496,7 @@ MakefileGenerator::init()
inn.toLatin1().constData());
continue;
}
- outn = fileFixify(inn.left(inn.length() - 3), FileFixifyBackwards);
+ outn = fileFixify(inn.left(inn.size() - 3), FileFixifyBackwards);
}
const ProKey confign(sub + ".CONFIG");
@@ -536,7 +517,7 @@ MakefileGenerator::init()
QString line = QString::fromLatin1(in.readLine());
if (line.startsWith("!!IF ")) {
if (state.isEmpty() || state.top() == IN_CONDITION) {
- QString test = line.mid(5, line.length()-(5+1));
+ QString test = line.mid(5, line.size()-(5+1));
if (project->test(test, inn, count))
state.push(IN_CONDITION);
else
@@ -549,7 +530,7 @@ MakefileGenerator::init()
warn_msg(WarnLogic, "(%s:%d): Unexpected else condition",
in.fileName().toLatin1().constData(), count);
} else if (state.top() == PENDING_CONDITION) {
- QString test = line.mid(7, line.length()-(7+1));
+ QString test = line.mid(7, line.size()-(7+1));
if (project->test(test, inn, count)) {
state.pop();
state.push(IN_CONDITION);
@@ -637,6 +618,10 @@ MakefileGenerator::init()
const ProStringList &config = v[ProKey(*it + ".CONFIG")];
if (config.indexOf("ignore_no_exist") != -1)
compiler.flags |= Compiler::CompilerRemoveNoExist;
+ else
+ compiler.flags |= Compiler::CompilerWarnNoExist;
+ if (config.indexOf("remove_no_exist") != -1)
+ compiler.flags |= Compiler::CompilerRemoveNoExist;
if (config.indexOf("no_dependencies") != -1)
compiler.flags |= Compiler::CompilerNoCheckDeps;
if (config.indexOf("add_inputs_as_makefile_deps") != -1)
@@ -658,12 +643,12 @@ MakefileGenerator::init()
}
{ //do the path fixifying
ProStringList paths;
- for(x = 0; x < compilers.count(); ++x) {
+ for(x = 0; x < compilers.size(); ++x) {
if(!paths.contains(compilers.at(x).variable_in))
paths << compilers.at(x).variable_in;
}
paths << "INCLUDEPATH" << "QMAKE_INTERNAL_INCLUDED_FILES" << "PRECOMPILED_HEADER";
- for(int y = 0; y < paths.count(); y++) {
+ for(int y = 0; y < paths.size(); y++) {
ProStringList &l = v[paths[y].toKey()];
for (ProStringList::Iterator it = l.begin(); it != l.end(); ++it) {
if((*it).isEmpty())
@@ -677,7 +662,7 @@ MakefileGenerator::init()
if(noIO() || !doDepends() || project->isActiveConfig("GNUmake"))
QMakeSourceFileInfo::setDependencyMode(QMakeSourceFileInfo::NonRecursive);
- for(x = 0; x < compilers.count(); ++x)
+ for(x = 0; x < compilers.size(); ++x)
initCompiler(compilers.at(x));
//merge actual compiler outputs into their variable_out. This is done last so that
@@ -788,7 +773,7 @@ MakefileGenerator::init()
incDirs.join(QString(" :: ")).toLatin1().constData());
//add to dependency engine
- for(x = 0; x < compilers.count(); ++x) {
+ for(x = 0; x < compilers.size(); ++x) {
const MakefileGenerator::Compiler &comp = compilers.at(x);
if(!(comp.flags & Compiler::CompilerNoCheckDeps)) {
const ProKey ikey(comp.variable_in);
@@ -844,14 +829,14 @@ MakefileGenerator::init()
QString dir, regex = Option::normalizePath(dep);
if (regex.lastIndexOf('/') != -1) {
dir = regex.left(regex.lastIndexOf('/') + 1);
- regex.remove(0, dir.length());
+ regex.remove(0, dir.size());
}
QStringList files = QDir(dir).entryList(QStringList(regex));
if(files.isEmpty()) {
warn_msg(WarnLogic, "Dependency for [%s]: Not found %s", (*file_it).toLatin1().constData(),
dep.toLatin1().constData());
} else {
- for(int i = 0; i < files.count(); i++)
+ for(int i = 0; i < files.size(); i++)
out_deps.append(dir + files[i]);
}
}
@@ -1055,7 +1040,7 @@ MakefileGenerator::writeProjectMakefile()
//install
t << "install: ";
- for (SubTarget *s : qAsConst(targets))
+ for (SubTarget *s : std::as_const(targets))
t << s->target << '-';
t << "install " << Qt::endl;
@@ -1197,7 +1182,7 @@ QString
MakefileGenerator::filePrefixRoot(const QString &root, const QString &path)
{
QString ret(path);
- if(path.length() > 2 && path[1] == ':') //c:\foo
+ if(path.size() > 2 && path[1] == ':') //c:\foo
ret.insert(2, root);
else
ret.prepend(root);
@@ -1273,14 +1258,14 @@ MakefileGenerator::writeInstalls(QTextStream &t, bool noBuild)
qPrintable(wild), qPrintable((*it).toQString()),
qPrintable(base_path));
} else {
- QString dir_sfx = dirstr.mid(base_path.length());
+ QString dir_sfx = dirstr.mid(base_path.size());
dst_dir += dir_sfx;
if (!dir_sfx.isEmpty() && !made_dirs.contains(dir_sfx)) {
made_dirs.insert(dir_sfx);
QString tmp_dst = fileFixify(dst_dir, FileFixifyAbsolute, false);
tmp_dst.chop(1);
inst << mkdir_p_asstring(filePrefixRoot(root, tmp_dst));
- for (int i = dst.length(); i < dst_dir.length(); i++) {
+ for (int i = dst.size(); i < dst_dir.size(); i++) {
if (dst_dir.at(i) == Option::dir_sep) {
QString subd = dst_dir.left(i);
if (!removed_dirs.contains(subd)) {
@@ -1340,7 +1325,7 @@ MakefileGenerator::writeInstalls(QTextStream &t, bool noBuild)
inst << cmd;
uninst.append(rm_dir_contents + " " + escapeFilePath(filePrefixRoot(root, fileFixify(dst_dir + filestr, FileFixifyAbsolute, false))));
}
- for(int x = 0; x < files.count(); x++) {
+ for(int x = 0; x < files.size(); x++) {
QString file = files[x];
uninst.append(rm_dir_contents + " " + escapeFilePath(filePrefixRoot(root, fileFixify(dst_dir + file, FileFixifyAbsolute, false))));
QFileInfo fi(fileInfo(dirstr + file));
@@ -1640,7 +1625,7 @@ MakefileGenerator::replaceExtraCompilerVariables(
QFileInfo fi(fileInfo(Option::normalizePath(in.at(i))));
QString ext;
// Ensure complementarity with QMAKE_FILE_BASE
- int baseLen = fi.completeBaseName().length();
+ int baseLen = fi.completeBaseName().size();
if(baseLen == 0)
ext = fi.fileName();
else
@@ -1706,7 +1691,7 @@ MakefileGenerator::replaceExtraCompilerVariables(
fullVal = val.join(' ');
}
ret.replace(match.capturedStart(), match.capturedLength(), fullVal);
- rep += fullVal.length();
+ rep += fullVal.size();
} else {
rep = match.capturedEnd();
}
@@ -1907,7 +1892,7 @@ void MakefileGenerator::callExtraCompilerDependCommand(const ProString &extraCom
return;
QDir outDir(Option::output_dir);
QStringList dep_cmd_deps = splitDeps(indeps, dep_lines);
- for (int i = 0; i < dep_cmd_deps.count(); ++i) {
+ for (int i = 0; i < dep_cmd_deps.size(); ++i) {
QString &file = dep_cmd_deps[i];
const QString absFile = outDir.absoluteFilePath(file);
if (absFile == file) {
@@ -1985,7 +1970,7 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t)
if (raw_clean.isEmpty())
raw_clean << tmp_out;
QString tmp_clean;
- for (const QString &rc : qAsConst(raw_clean))
+ for (const QString &rc : std::as_const(raw_clean))
tmp_clean += ' ' + escapeFilePath(Option::fixPathToTargetOS(rc));
QString tmp_clean_cmds = project->values(ProKey(*it + ".clean_commands")).join(' ');
if(!tmp_inputs.isEmpty())
@@ -2010,7 +1995,7 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t)
for (ProStringList::ConstIterator input = tmp_inputs.cbegin(); input != tmp_inputs.cend(); ++input) {
QString tinp = (*input).toQString();
QString out = replaceExtraCompilerVariables(tmp_out, tinp, QString(), NoShell);
- for (const QString &rc : qAsConst(raw_clean)) {
+ for (const QString &rc : std::as_const(raw_clean)) {
dels << ' ' + escapeFilePath(fileFixify(
replaceExtraCompilerVariables(rc, tinp, out, NoShell),
FileFixifyFromOutdir));
@@ -2021,9 +2006,9 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t)
} else {
QString files;
const int commandlineLimit = 2047; // NT limit, expanded
- for (const QString &file : qAsConst(dels)) {
- if(del_statement.length() + files.length() +
- qMax(fixEnvVariables(file).length(), file.length()) > commandlineLimit) {
+ for (const QString &file : std::as_const(dels)) {
+ if(del_statement.size() + files.size() +
+ qMax(fixEnvVariables(file).size(), file.size()) > commandlineLimit) {
cleans.append(files);
files.clear();
}
@@ -2243,6 +2228,7 @@ MakefileGenerator::writeDummyMakefile(QTextStream &t)
<< "@echo \"Skipped.\"\n\n";
writeMakeQmake(t);
t << "FORCE:\n\n";
+ suppressBuiltinRules(t);
return true;
}
@@ -2257,6 +2243,7 @@ MakefileGenerator::writeMakefile(QTextStream &t)
writeInstalls(t);
t << "FORCE:\n\n";
+ suppressBuiltinRules(t);
return true;
}
@@ -2285,11 +2272,11 @@ QString MakefileGenerator::buildArgs(bool withExtra)
{
QString ret;
- for (const QString &arg : qAsConst(Option::globals->qmake_args))
+ for (const QString &arg : std::as_const(Option::globals->qmake_args))
ret += " " + shellQuote(arg);
if (withExtra && !Option::globals->qmake_extra_args.isEmpty()) {
ret += " --";
- for (const QString &arg : qAsConst(Option::globals->qmake_extra_args))
+ for (const QString &arg : std::as_const(Option::globals->qmake_extra_args))
ret += " " + shellQuote(arg);
}
return ret;
@@ -2404,7 +2391,7 @@ MakefileGenerator::findSubDirsSubTargets() const
if(new_slsh != -1)
basename = basename.mid(new_slsh+1);
if(st->profile != basename + Option::pro_ext)
- st->makefile += "." + st->profile.left(st->profile.length() - Option::pro_ext.length());
+ st->makefile += "." + st->profile.left(st->profile.size() - Option::pro_ext.size());
}
}
const ProKey dkey(fixedSubdir + ".depends");
@@ -2543,7 +2530,7 @@ MakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::SubT
if(!out_directory.isEmpty() && !out_directory.endsWith(Option::dir_sep))
out_directory += Option::dir_sep;
if(!abs_source_path.isEmpty() && out_directory.startsWith(abs_source_path))
- out_directory = Option::output_dir + out_directory.mid(abs_source_path.length());
+ out_directory = Option::output_dir + out_directory.mid(abs_source_path.size());
QString out_directory_cdin = out_directory.isEmpty() ? QString("\n\t")
: "\n\tcd " + escapeFilePath(out_directory) + " && ";
@@ -2556,7 +2543,7 @@ MakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::SubT
out = subtarget->makefile;
in = escapeFilePath(fileFixify(in_directory + subtarget->profile, FileFixifyAbsolute));
if(out.startsWith(in_directory))
- out = out.mid(in_directory.length());
+ out = out.mid(in_directory.size());
out = escapeFilePath(out);
t << subtarget->target << "-qmake_all: ";
if (flags & SubTargetOrdered) {
@@ -2721,7 +2708,7 @@ MakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::SubT
if(!out_directory.isEmpty() && !out_directory.endsWith(Option::dir_sep))
out_directory += Option::dir_sep;
if(!abs_source_path.isEmpty() && out_directory.startsWith(abs_source_path))
- out_directory = Option::output_dir + out_directory.mid(abs_source_path.length());
+ out_directory = Option::output_dir + out_directory.mid(abs_source_path.size());
if(!recurse.contains(subtarget->name))
continue;
@@ -2736,7 +2723,7 @@ MakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::SubT
out = subtarget->makefile;
in = escapeFilePath(fileFixify(in_directory + subtarget->profile, FileFixifyAbsolute));
if (out.startsWith(in_directory))
- out = out.mid(in_directory.length());
+ out = out.mid(in_directory.size());
out = escapeFilePath(out);
}
@@ -2778,6 +2765,13 @@ MakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::SubT
writeInstalls(t, true);
}
t << "FORCE:\n\n";
+ suppressBuiltinRules(t);
+}
+
+void
+MakefileGenerator::suppressBuiltinRules(QTextStream &t) const
+{
+ t << ".SUFFIXES:\n\n";
}
void
@@ -2826,7 +2820,7 @@ MakefileGenerator::writeMakeQmake(QTextStream &t, bool noDummyQmakeAll)
QFileInfo
MakefileGenerator::fileInfo(QString file) const
{
- static QHash<FileInfoCacheKey, QFileInfo> *cache = nullptr;
+ Q_CONSTINIT static QHash<FileInfoCacheKey, QFileInfo> *cache = nullptr;
static QFileInfo noInfo = QFileInfo();
if(!cache) {
cache = new QHash<FileInfoCacheKey, QFileInfo>;
@@ -2865,7 +2859,7 @@ MakefileGenerator::fixLibFlags(const ProKey &var)
const ProStringList &in = project->values(var);
ProStringList ret;
- ret.reserve(in.length());
+ ret.reserve(in.size());
for (const ProString &v : in)
ret << fixLibFlag(v);
return ret;
@@ -3031,7 +3025,7 @@ MakefileGenerator::fileFixify(const QString &file, FileFixifyTypes fix, bool can
if(ret == match_dir) {
ret = "";
} else if(ret.startsWith(match_dir + Option::dir_sep)) {
- ret = ret.mid(match_dir.length() + Option::dir_sep.length());
+ ret = ret.mid(match_dir.size() + Option::dir_sep.size());
} else {
//figure out the depth
int depth = 4;
@@ -3053,7 +3047,7 @@ MakefileGenerator::fileFixify(const QString &file, FileFixifyTypes fix, bool can
break;
if(ret.startsWith(match_dir + Option::dir_sep)) {
//concat
- int remlen = ret.length() - (match_dir.length() + 1);
+ int remlen = ret.size() - (match_dir.size() + 1);
if(remlen < 0)
remlen = 0;
ret = ret.right(remlen);
@@ -3127,12 +3121,12 @@ MakefileGenerator::findFileForDep(const QMakeLocalFileName &dep, const QMakeLoca
QList<QMakeLocalFileName> depdirs = QMakeSourceFileInfo::dependencyPaths();
depdirs.prepend(fileInfo(file.real()).absoluteDir().path());
QString pwd = qmake_getpwd();
- if(pwd.at(pwd.length()-1) != '/')
+ if(pwd.at(pwd.size()-1) != '/')
pwd += '/';
- for(int i = 0; i < depdirs.count(); i++) {
+ for(int i = 0; i < depdirs.size(); i++) {
QString dir = depdirs.at(i).real();
if(!QDir::isRelativePath(dir) && dir.startsWith(pwd))
- dir = dir.mid(pwd.length());
+ dir = dir.mid(pwd.size());
if(QDir::isRelativePath(dir)) {
if(!dir.endsWith(Option::dir_sep))
dir += Option::dir_sep;
@@ -3248,7 +3242,7 @@ MakefileGenerator::pkgConfigFileName(bool fixify)
ret = project->first("TARGET").toQString();
int slsh = ret.lastIndexOf(Option::dir_sep);
if (slsh != -1)
- ret = ret.right(ret.length() - slsh - 1);
+ ret = ret.right(ret.size() - slsh - 1);
if (ret.startsWith("lib"))
ret = ret.mid(3);
int dot = ret.indexOf('.');
@@ -3492,20 +3486,26 @@ ProKey MakefileGenerator::fullTargetVariable() const
return "TARGET";
}
+/*
+ * Create a response file and return its file name.
+ */
QString MakefileGenerator::createResponseFile(
const QString &baseName,
const ProStringList &objList,
- const QString &prefix)
+ const QString &prefix) const
{
- QString fileName = baseName + '.' + fileVar("QMAKE_ORIG_TARGET");
+ QString fileName = baseName + '.' + var("QMAKE_ORIG_TARGET");
if (!var("BUILD_NAME").isEmpty())
fileName += '.' + var("BUILD_NAME");
if (!var("MAKEFILE").isEmpty())
fileName += '.' + var("MAKEFILE");
QString filePath = Option::output_dir + QDir::separator() + fileName;
QFile file(filePath);
- if (!file.open(QIODevice::WriteOnly | QIODevice::Text))
- return QString();
+ if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
+ fprintf(stderr, "Error: Cannot open response file '%s' for writing.\n",
+ qPrintable(filePath));
+ exit(1);
+ }
QTextStream t(&file);
for (ProStringList::ConstIterator it = objList.constBegin(); it != objList.constEnd(); ++it) {
QString path = (*it).toQString();
@@ -3525,4 +3525,46 @@ QString MakefileGenerator::createResponseFile(
return fileName;
}
+/*
+ * If the threshold for response files are overstepped, create a response file for the linker
+ * command line.
+ */
+MakefileGenerator::LinkerResponseFileInfo MakefileGenerator::maybeCreateLinkerResponseFile() const
+{
+ bool useLinkObjectMax = false;
+ bool ok;
+ int threshold = project->first("QMAKE_RESPONSEFILE_THRESHOLD").toInt(&ok);
+ if (!ok) {
+ threshold = project->first("QMAKE_LINK_OBJECT_MAX").toInt(&ok);
+ if (ok)
+ useLinkObjectMax = true;
+ }
+ if (!ok)
+ return {};
+
+ ProStringList linkerInputs = project->values("OBJECTS");
+ if (useLinkObjectMax) {
+ // When using QMAKE_LINK_OBJECT_MAX, the number of object files (regardless of their path
+ // length) decides whether to use a response file. This is far from being a useful
+ // heuristic but let's keep this behavior for backwards compatibility.
+ if (linkerInputs.size() < threshold)
+ return {};
+ } else {
+ // When using QMAKE_REPONSEFILE_THRESHOLD, try to determine the command line length of the
+ // inputs.
+ linkerInputs += project->values("LIBS");
+ int totalLength = std::accumulate(linkerInputs.cbegin(), linkerInputs.cend(), 0,
+ [](int total, const ProString &input) {
+ return total + input.size() + 1;
+ });
+ if (totalLength < threshold)
+ return {};
+ }
+
+ return {
+ createResponseFile(fileVar("OBJECTS_DIR") + var("QMAKE_LINK_OBJECT_SCRIPT"), linkerInputs),
+ useLinkObjectMax
+ };
+}
+
QT_END_NAMESPACE
diff --git a/qmake/generators/makefile.h b/qmake/generators/makefile.h
index 60431d622a..6ab4ad505d 100644
--- a/qmake/generators/makefile.h
+++ b/qmake/generators/makefile.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** 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) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef MAKEFILE_H
#define MAKEFILE_H
@@ -121,6 +96,7 @@ protected:
void writeSubTargetCall(QTextStream &t,
const QString &in_directory, const QString &in, const QString &out_directory, const QString &out,
const QString &out_directory_cdin, const QString &makefilein);
+ virtual void suppressBuiltinRules(QTextStream &t) const;
virtual void writeSubMakeCall(QTextStream &t, const QString &outDirectory_cdin,
const QString &makeFileIn);
virtual void writeSubTargets(QTextStream &t, QList<SubTarget*> subtargets, int flags);
@@ -169,7 +145,8 @@ protected:
CompilerBuiltin = 0x01,
CompilerNoCheckDeps = 0x02,
CompilerRemoveNoExist = 0x04,
- CompilerAddInputsAsMakefileDeps = 0x08
+ CompilerWarnNoExist = 0x08,
+ CompilerAddInputsAsMakefileDeps = 0x10
};
uint flags, type;
};
@@ -266,7 +243,17 @@ protected:
const QString &fixedFile);
QString createResponseFile(const QString &baseName,
const ProStringList &objList,
- const QString &prefix = QString());
+ const QString &prefix = QString()) const;
+
+ struct LinkerResponseFileInfo
+ {
+ QString filePath;
+ bool onlyObjects;
+
+ bool isValid() const { return !filePath.isEmpty(); }
+ };
+
+ LinkerResponseFileInfo maybeCreateLinkerResponseFile() const;
public:
QMakeProject *projectFile() const;
diff --git a/qmake/generators/makefiledeps.cpp b/qmake/generators/makefiledeps.cpp
index b5a404de32..8e8d42cc96 100644
--- a/qmake/generators/makefiledeps.cpp
+++ b/qmake/generators/makefiledeps.cpp
@@ -1,34 +1,10 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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) 2016 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 "makefiledeps.h"
#include "option.h"
+#include <qfile.h>
#include <qdir.h>
#include <qdatetime.h>
#include <qfileinfo.h>
@@ -40,16 +16,8 @@
# include <io.h>
#endif
#include <qdebug.h>
-#include <stdio.h>
-#include <stdlib.h>
#include <time.h>
-#include <fcntl.h>
-#include <sys/types.h>
-#include <sys/stat.h>
#include <limits.h>
-#if defined(_MSC_VER) && _MSC_VER >= 1400
-#include <share.h>
-#endif
QT_BEGIN_NAMESPACE
@@ -196,7 +164,7 @@ void QMakeSourceFileInfo::setDependencyPaths(const QList<QMakeLocalFileName> &l)
{
// Ensure that depdirs does not contain the same paths several times, to minimize the stats
QList<QMakeLocalFileName> ll;
- for (int i = 0; i < l.count(); ++i) {
+ for (int i = 0; i < l.size(); ++i) {
if (!ll.contains(l.at(i)))
ll.append(l.at(i));
}
@@ -397,13 +365,21 @@ static bool matchWhileUnsplitting(const char *buffer, int buffer_len, int start,
return true;
}
-/* Advance from an opening quote at buffer[offset] to the matching close quote. */
+/* Advance from an opening quote at buffer[offset] to the matching close quote.
+ If an apostrophe turns out to be a digit-separator in a numeric literal,
+ rather than the start of a character literal, treat it as both the open and
+ the close quote of the "string" that isn't there.
+*/
static int scanPastString(char *buffer, int buffer_len, int offset, int *lines)
{
// http://en.cppreference.com/w/cpp/language/string_literal
// It might be a C++11 raw string.
bool israw = false;
- if (buffer[offset] == '"' && offset > 0) {
+
+ Q_ASSERT(offset < buffer_len);
+ if (offset <= 0) {
+ // skip, neither of these special cases applies here
+ } else if (buffer[offset] == '"') {
int explore = offset - 1;
bool prefix = false; // One of L, U, u or u8 may appear before R
bool saw8 = false; // Partial scan of u8
@@ -447,6 +423,19 @@ static int scanPastString(char *buffer, int buffer_len, int offset, int *lines)
&& (isalnum(buffer[explore]) || buffer[explore] == '_')) {
israw = false;
}
+
+ } else {
+ // Is this apostrophe a digit separator rather than the start of a
+ // character literal ? If so, there was no string to scan past, so
+ // treat the apostrophe as both open and close.
+ Q_ASSERT(buffer[offset] == '\'' && offset > 0);
+ // Wrap std::isdigit() to package the casting to unsigned char.
+ const auto isDigit = [](unsigned char c) { return std::isdigit(c); };
+ if (isDigit(buffer[offset - 1]) && offset + 1 < buffer_len && isDigit(buffer[offset + 1])) {
+ // One exception: u8'0' is a perfectly good character literal.
+ if (offset < 2 || buffer[offset - 1] != '8' || buffer[offset - 2] != 'u')
+ return offset;
+ }
}
if (israw) {
@@ -515,28 +504,17 @@ bool QMakeSourceFileInfo::findDeps(SourceFile *file)
const QMakeLocalFileName sourceFile = fixPathForFile(file->file, true);
- struct stat fst;
char *buffer = nullptr;
int buffer_len = 0;
{
- int fd;
-#if defined(_MSC_VER) && _MSC_VER >= 1400
- if (_sopen_s(&fd, sourceFile.local().toLatin1().constData(),
- _O_RDONLY, _SH_DENYNO, _S_IREAD) != 0)
- fd = -1;
-#else
- fd = open(sourceFile.local().toLatin1().constData(), O_RDONLY);
-#endif
- if (fd == -1 || fstat(fd, &fst) || S_ISDIR(fst.st_mode)) {
- if (fd != -1)
- QT_CLOSE(fd);
+ QFile f(sourceFile.local());
+ if (!f.open(QIODevice::ReadOnly))
return false;
- }
- buffer = getBuffer(fst.st_size);
+ const qint64 fs = f.size();
+ buffer = getBuffer(fs);
for(int have_read = 0;
- (have_read = QT_READ(fd, buffer + buffer_len, fst.st_size - buffer_len));
+ (have_read = f.read(buffer + buffer_len, fs - buffer_len));
buffer_len += have_read) ;
- QT_CLOSE(fd);
}
if(!buffer)
return false;
@@ -831,7 +809,7 @@ bool QMakeSourceFileInfo::findDeps(SourceFile *file)
}
}
if(!exists) { //path lookup
- for (const QMakeLocalFileName &depdir : qAsConst(depdirs)) {
+ for (const QMakeLocalFileName &depdir : std::as_const(depdirs)) {
QMakeLocalFileName f(depdir.real() + Option::dir_sep + lfn.real());
QFileInfo fi(findFileInfo(f));
if(fi.exists() && !fi.isDir()) {
@@ -901,25 +879,13 @@ bool QMakeSourceFileInfo::findMocs(SourceFile *file)
int buffer_len = 0;
char *buffer = nullptr;
{
- struct stat fst;
- int fd;
-#if defined(_MSC_VER) && _MSC_VER >= 1400
- if (_sopen_s(&fd, fixPathForFile(file->file, true).local().toLocal8Bit().constData(),
- _O_RDONLY, _SH_DENYNO, _S_IREAD) != 0)
- fd = -1;
-#else
- fd = open(fixPathForFile(file->file, true).local().toLocal8Bit().constData(), O_RDONLY);
-#endif
- if (fd == -1 || fstat(fd, &fst) || S_ISDIR(fst.st_mode)) {
- if (fd != -1)
- QT_CLOSE(fd);
+ QFile f(fixPathForFile(file->file, true).local());
+ if (!f.open(QIODevice::ReadOnly))
return false; //shouldn't happen
- }
- buffer = getBuffer(fst.st_size);
- while (int have_read = QT_READ(fd, buffer + buffer_len, fst.st_size - buffer_len))
+ const qint64 fs = f.size();
+ buffer = getBuffer(fs);
+ while (int have_read = f.read(buffer + buffer_len, fs - buffer_len))
buffer_len += have_read;
-
- QT_CLOSE(fd);
}
debug_msg(2, "findMocs: %s", file->file.local().toLatin1().constData());
diff --git a/qmake/generators/makefiledeps.h b/qmake/generators/makefiledeps.h
index 31587371ef..c7743d7eb5 100644
--- a/qmake/generators/makefiledeps.h
+++ b/qmake/generators/makefiledeps.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** 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) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef MAKEFILEDEPS_H
#define MAKEFILEDEPS_H
diff --git a/qmake/generators/metamakefile.cpp b/qmake/generators/metamakefile.cpp
index 8ba941c213..79443a1d4b 100644
--- a/qmake/generators/metamakefile.cpp
+++ b/qmake/generators/metamakefile.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** 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) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "metamakefile.h"
#include "qdir.h"
@@ -77,7 +52,7 @@ public:
void
BuildsMetaMakefileGenerator::clearBuilds()
{
- for(int i = 0; i < makefiles.count(); i++) {
+ for(int i = 0; i < makefiles.size(); i++) {
Build *build = makefiles[i];
if(QMakeProject *p = build->makefile->projectFile()) {
if(p != project)
@@ -98,12 +73,12 @@ BuildsMetaMakefileGenerator::init()
const ProStringList &builds = project->values("BUILDS");
bool use_single_build = builds.isEmpty();
- if(builds.count() > 1 && Option::output.fileName() == "-") {
+ if(builds.size() > 1 && Option::output.fileName() == "-") {
use_single_build = true;
warn_msg(WarnLogic, "Cannot direct to stdout when using multiple BUILDS.");
}
if(!use_single_build) {
- for(int i = 0; i < builds.count(); i++) {
+ for(int i = 0; i < builds.size(); i++) {
ProString build = builds[i];
MakefileGenerator *makefile = processBuild(build);
if(!makefile)
@@ -116,7 +91,7 @@ BuildsMetaMakefileGenerator::init()
} else {
Build *b = new Build;
b->name = name;
- if(builds.count() != 1)
+ if(builds.size() != 1)
b->build = build.toQString();
b->makefile = makefile;
makefiles += b;
@@ -151,7 +126,7 @@ BuildsMetaMakefileGenerator::write()
bool ret = true;
const QString &output_name = Option::output.fileName();
- for(int i = 0; ret && i < makefiles.count(); i++) {
+ for(int i = 0; ret && i < makefiles.size(); i++) {
Option::output.setFileName(output_name);
Build *build = makefiles[i];
@@ -165,7 +140,10 @@ BuildsMetaMakefileGenerator::write()
if(Option::output.fileName() == "-") {
Option::output.setFileName("");
Option::output_dir = qmake_getpwd();
- Option::output.open(stdout, QIODevice::WriteOnly | QIODevice::Text);
+ if (!Option::output.open(stdout, QIODevice::WriteOnly | QIODevice::Text)) {
+ fprintf(stderr, "Failure to open stdout\n");
+ return false;
+ }
using_stdout = true;
} else {
if(Option::output.fileName().isEmpty() &&
@@ -248,7 +226,7 @@ void BuildsMetaMakefileGenerator::accumulateVariableFromBuilds(const ProKey &nam
void BuildsMetaMakefileGenerator::checkForConflictingTargets() const
{
- if (makefiles.count() < 3) {
+ if (makefiles.size() < 3) {
// Checking for conflicts only makes sense if we have more than one BUILD,
// and the last entry in makefiles is the "glue" Build.
return;
@@ -259,7 +237,7 @@ void BuildsMetaMakefileGenerator::checkForConflictingTargets() const
}
using TargetInfo = std::pair<Build *, ProString>;
QList<TargetInfo> targets;
- const int last = makefiles.count() - 1;
+ const int last = makefiles.size() - 1;
targets.resize(last);
for (int i = 0; i < last; ++i) {
Build *b = makefiles.at(i);
@@ -326,7 +304,7 @@ SubdirsMetaMakefileGenerator::init()
if(!thispwd.endsWith('/'))
thispwd += '/';
const ProStringList &subdirs = project->values("SUBDIRS");
- static int recurseDepth = -1;
+ Q_CONSTINIT static int recurseDepth = -1;
++recurseDepth;
for(int i = 0; i < subdirs.size(); ++i) {
Subdir *sub = new Subdir;
@@ -349,7 +327,7 @@ SubdirsMetaMakefileGenerator::init()
if(!subdir.isRelative()) { //we can try to make it relative
QString subdir_path = subdir.filePath();
if(subdir_path.startsWith(thispwd))
- subdir = QFileInfo(subdir_path.mid(thispwd.length()));
+ subdir = QFileInfo(subdir_path.mid(thispwd.size()));
}
//handle sub project
@@ -416,12 +394,12 @@ SubdirsMetaMakefileGenerator::write()
const QString &pwd = qmake_getpwd();
const QString &output_dir = Option::output_dir;
const QString &output_name = Option::output.fileName();
- for(int i = 0; ret && i < subs.count(); i++) {
+ for(int i = 0; ret && i < subs.size(); i++) {
const Subdir *sub = subs.at(i);
qmake_setpwd(sub->input_dir);
Option::output_dir = QFileInfo(sub->output_dir).absoluteFilePath();
Option::output.setFileName(sub->output_file);
- if(i != subs.count()-1) {
+ if(i != subs.size()-1) {
for (int ind = 0; ind < sub->indent; ++ind)
printf(" ");
printf("Writing %s\n", QDir::cleanPath(Option::output_dir+"/"+
@@ -439,7 +417,7 @@ SubdirsMetaMakefileGenerator::write()
SubdirsMetaMakefileGenerator::~SubdirsMetaMakefileGenerator()
{
- for(int i = 0; i < subs.count(); i++)
+ for(int i = 0; i < subs.size(); i++)
delete subs[i];
subs.clear();
}
diff --git a/qmake/generators/metamakefile.h b/qmake/generators/metamakefile.h
index 9337130143..6ce00a851e 100644
--- a/qmake/generators/metamakefile.h
+++ b/qmake/generators/metamakefile.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** 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) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef METAMAKEFILE_H
#define METAMAKEFILE_H
diff --git a/qmake/generators/projectgenerator.cpp b/qmake/generators/projectgenerator.cpp
index 4e1b32fb69..96d7b26370 100644
--- a/qmake/generators/projectgenerator.cpp
+++ b/qmake/generators/projectgenerator.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** 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) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "projectgenerator.h"
#include "option.h"
@@ -79,7 +54,7 @@ ProjectGenerator::init()
dirs.prepend(qmake_getpwd());
}
- for(int i = 0; i < dirs.count(); ++i) {
+ for(int i = 0; i < dirs.size(); ++i) {
QString dir, regex, pd = dirs.at(i);
bool add_depend = false;
if(exists(pd)) {
@@ -91,7 +66,7 @@ ProjectGenerator::init()
dir += Option::dir_sep;
if (Option::recursive) {
QStringList files = QDir(dir).entryList(QDir::Files);
- for (int i = 0; i < files.count(); i++)
+ for (int i = 0; i < files.size(); i++)
dirs.append(dir + files[i] + QDir::separator() + builtin_regex);
}
regex = builtin_regex;
@@ -112,16 +87,16 @@ ProjectGenerator::init()
int s = regex.lastIndexOf(Option::dir_sep);
if(s != -1) {
dir = regex.left(s+1);
- regex = regex.right(regex.length() - (s+1));
+ regex = regex.right(regex.size() - (s+1));
}
const QDir d(dir);
if (Option::recursive) {
QStringList entries = d.entryList(QDir::Dirs | QDir::NoDotAndDotDot);
- for (int i = 0; i < entries.count(); i++)
+ for (int i = 0; i < entries.size(); i++)
dirs.append(dir + entries[i] + QDir::separator() + regex);
}
QStringList files = d.entryList(QDir::nameFiltersFromString(regex));
- for(int i = 0; i < (int)files.count(); i++) {
+ for(int i = 0; i < (int)files.size(); i++) {
QString file = d.absoluteFilePath(files[i]);
if (addFile(file)) {
add_depend = true;
@@ -141,7 +116,7 @@ ProjectGenerator::init()
if(Option::projfile::do_pwd)
knownDirs.prepend(".");
const QString out_file = fileFixify(Option::output.fileName());
- for(int i = 0; i < knownDirs.count(); ++i) {
+ for(int i = 0; i < knownDirs.size(); ++i) {
QString pd = knownDirs.at(i);
if(exists(pd)) {
QString newdir = pd;
@@ -154,7 +129,7 @@ ProjectGenerator::init()
subdirs.append(newdir);
} else {
QStringList profiles = QDir(newdir).entryList(QStringList("*" + Option::pro_ext), QDir::Files);
- for(int i = 0; i < (int)profiles.count(); i++) {
+ for(int i = 0; i < (int)profiles.size(); i++) {
QString nd = newdir;
if(nd == ".")
nd = "";
@@ -168,7 +143,7 @@ ProjectGenerator::init()
}
if (Option::recursive) {
QStringList dirs = QDir(newdir).entryList(QDir::Dirs | QDir::NoDotAndDotDot);
- for(int i = 0; i < (int)dirs.count(); i++) {
+ for(int i = 0; i < (int)dirs.size(); i++) {
QString nd = fileFixify(newdir + QDir::separator() + dirs[i]);
if (!knownDirs.contains(nd, Qt::CaseInsensitive))
knownDirs.append(nd);
@@ -180,12 +155,12 @@ ProjectGenerator::init()
int s = regx.lastIndexOf(Option::dir_sep);
if(s != -1) {
dir = regx.left(s+1);
- regx = regx.right(regx.length() - (s+1));
+ regx = regx.right(regx.size() - (s+1));
}
QStringList files = QDir(dir).entryList(QDir::nameFiltersFromString(regx),
QDir::Dirs | QDir::NoDotAndDotDot);
ProStringList &subdirs = v["SUBDIRS"];
- for(int i = 0; i < (int)files.count(); i++) {
+ for(int i = 0; i < (int)files.size(); i++) {
QString newdir(dir + files[i]);
QFileInfo fi(fileInfo(newdir));
{
@@ -195,7 +170,7 @@ ProjectGenerator::init()
subdirs.append(newdir);
} else {
QStringList profiles = QDir(newdir).entryList(QStringList("*" + Option::pro_ext), QDir::Files);
- for(int i = 0; i < (int)profiles.count(); i++) {
+ for(int i = 0; i < (int)profiles.size(); i++) {
QString nd = newdir + QDir::separator() + files[i];
fileFixify(nd);
if(files[i] != "." && files[i] != ".." && !subdirs.contains(nd, Qt::CaseInsensitive)) {
@@ -256,7 +231,7 @@ ProjectGenerator::init()
}
if(!h_ext.isEmpty()) {
for(int cppit = 0; cppit < Option::cpp_ext.size(); ++cppit) {
- QString src(dep.left(dep.length() - h_ext.length()) +
+ QString src(dep.left(dep.size() - h_ext.size()) +
Option::cpp_ext.at(cppit));
if(exists(src)) {
ProStringList &srcl = v["SOURCES"];
@@ -346,7 +321,7 @@ ProjectGenerator::writeMakefile(QTextStream &t)
"# Please consult the documentation of the deprecated API in order to know\n"
"# how to port your code away from it.\n"
"# You can also select to disable deprecated APIs only up to a certain version of Qt.\n"
- "#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0\n\n";
+ "#DEFINES += QT_DISABLE_DEPRECATED_UP_TO=0x060000 # disables all APIs deprecated in Qt 6.0.0 and earlier\n\n";
t << "# Input" << "\n";
t << getWritableVar("HEADERS")
@@ -383,7 +358,7 @@ ProjectGenerator::addFile(QString file)
int s = file.lastIndexOf(Option::dir_sep);
if(s != -1)
dir = file.left(s+1);
- if(file.mid(dir.length(), Option::h_moc_mod.length()) == Option::h_moc_mod)
+ if(file.mid(dir.size(), Option::h_moc_mod.size()) == Option::h_moc_mod)
return false;
ProKey where;
@@ -453,9 +428,9 @@ ProjectGenerator::getWritableVar(const char *vk, bool)
else
ret = v + " += ";
QString join = vals.join(' ');
- if(ret.length() + join.length() > 80) {
+ if(ret.size() + join.size() > 80) {
QString spaces;
- for(int i = 0; i < ret.length(); i++)
+ for(int i = 0; i < ret.size(); i++)
spaces += " ";
join = vals.join(" \\\n" + spaces);
}
diff --git a/qmake/generators/projectgenerator.h b/qmake/generators/projectgenerator.h
index 374bad98c7..d1f5228140 100644
--- a/qmake/generators/projectgenerator.h
+++ b/qmake/generators/projectgenerator.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** 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) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef PROJECTGENERATOR_H
#define PROJECTGENERATOR_H
diff --git a/qmake/generators/unix/unixmake.cpp b/qmake/generators/unix/unixmake.cpp
index 07f8d861dc..c6771e7ab9 100644
--- a/qmake/generators/unix/unixmake.cpp
+++ b/qmake/generators/unix/unixmake.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** 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) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "unixmake.h"
#include "option.h"
@@ -39,7 +14,7 @@ QT_BEGIN_NAMESPACE
ProStringList UnixMakefileGenerator::libdirToFlags(const ProKey &key)
{
ProStringList results;
- for (const auto &libdir : qAsConst(project->values(key))) {
+ for (const auto &libdir : std::as_const(project->values(key))) {
if (!project->isEmpty("QMAKE_LFLAGS_RPATH") && project->isActiveConfig("rpath_libdirs"))
project->values("QMAKE_LFLAGS") += var("QMAKE_LFLAGS_RPATH") + libdir;
results.append("-L" + escapeFilePath(libdir));
@@ -73,7 +48,7 @@ UnixMakefileGenerator::init()
for (const ProString &iif : project->values("QMAKE_INTERNAL_INCLUDED_FILES")) {
if (iif == project->cacheFile())
continue;
- if (iif.startsWith(sroot) && iif.at(sroot.length()) == QLatin1Char('/'))
+ if (iif.startsWith(sroot) && iif.at(sroot.size()) == QLatin1Char('/'))
project->values("DISTFILES") += fileFixify(iif.toQString(), FileFixifyRelative);
}
@@ -126,7 +101,7 @@ UnixMakefileGenerator::init()
const ProStringList &rpathdirs = project->values("QMAKE_RPATHDIR");
for (int i = 0; i < rpathdirs.size(); ++i) {
QString rpathdir = rpathdirs[i].toQString();
- if (rpathdir.length() > 1 && rpathdir.at(0) == '$' && rpathdir.at(1) != '(') {
+ if (rpathdir.size() > 1 && rpathdir.at(0) == '$' && rpathdir.at(1) != '(') {
rpathdir.replace(0, 1, "\\$$"); // Escape from make and the shell
} else if (!rpathdir.startsWith('@') && fileInfo(rpathdir).isRelative()) {
QString rpathbase = project->first("QMAKE_REL_RPATH_BASE").toQString();
@@ -266,7 +241,6 @@ UnixMakefileGenerator::init()
if(project->isEmpty("QMAKE_BUNDLE_LOCATION"))
project->values("QMAKE_BUNDLE_LOCATION").append("Contents/MacOS");
project->values("QMAKE_PKGINFO").append(project->first("DESTDIR") + bundle + "/Contents/PkgInfo");
- project->values("QMAKE_BUNDLE_RESOURCE_FILE").append(project->first("DESTDIR") + bundle + "/Contents/Resources/empty.lproj");
} else if(project->first("TEMPLATE") == "lib" && !project->isActiveConfig("staticlib") &&
((!project->isActiveConfig("plugin") && project->isActiveConfig("lib_bundle")) ||
(project->isActiveConfig("plugin") && project->isActiveConfig("plugin_bundle")))) {
@@ -324,7 +298,7 @@ QStringList
ProStringList pchArchs = project->values("QMAKE_PCH_ARCHS");
if (pchArchs.isEmpty())
pchArchs << ProString(); // normal single-arch PCH
- for (const ProString &arch : qAsConst(pchArchs)) {
+ for (const ProString &arch : std::as_const(pchArchs)) {
auto pfx = header_prefix;
if (!arch.isEmpty())
pfx.replace(QLatin1String("${QMAKE_PCH_ARCH}"), arch.toQString());
@@ -362,7 +336,7 @@ QStringList
ProStringList pchArchs = project->values("QMAKE_PCH_ARCHS");
if (pchArchs.isEmpty())
pchArchs << ProString(); // normal single-arch PCH
- for (const ProString &arch : qAsConst(pchArchs)) {
+ for (const ProString &arch : std::as_const(pchArchs)) {
QString precompiledHeader = header_prefix + language + header_suffix;
if (!arch.isEmpty()) {
precompiledHeader.replace(QLatin1String("${QMAKE_PCH_ARCH}"),
@@ -417,7 +391,7 @@ UnixMakefileGenerator::findLibraries(bool linkPrl, bool mergeLflags)
libdirs.insert(libidx++, f);
} else if(opt.startsWith("-l")) {
QString lib = opt.mid(2);
- for (const QMakeLocalFileName &libdir : qAsConst(libdirs)) {
+ for (const QMakeLocalFileName &libdir : std::as_const(libdirs)) {
QString libBase = libdir.local() + '/'
+ project->first("QMAKE_PREFIX_SHLIB") + lib;
if (linkPrl && processPrlFile(libBase, true))
@@ -443,7 +417,7 @@ UnixMakefileGenerator::findLibraries(bool linkPrl, bool mergeLflags)
frameworkName.truncate(suffixPosition);
opt.remove(suffixMarker); // Apply suffix by removing marker
}
- for (const QMakeLocalFileName &dir : qAsConst(frameworkdirs)) {
+ for (const QMakeLocalFileName &dir : std::as_const(frameworkdirs)) {
auto processPrlIfFound = [&](QString directory) {
QString suffixedPrl = directory + opt;
if (processPrlFile(suffixedPrl, true))
@@ -461,7 +435,7 @@ UnixMakefileGenerator::findLibraries(bool linkPrl, bool mergeLflags)
break;
}
} else {
- if (opt.length() == 10)
+ if (opt.size() == 10)
++it;
// Skip
}
@@ -714,7 +688,7 @@ UnixMakefileGenerator::defaultInstall(const QString &t)
QString link = Option::fixPathToTargetOS(destdir + links[i], false);
int lslash = link.lastIndexOf(Option::dir_sep);
if(lslash != -1)
- link = link.right(link.length() - (lslash + 1));
+ link = link.right(link.size() - (lslash + 1));
QString dst_link = escapeFilePath(
filePrefixRoot(root, fileFixify(targetdir + link, FileFixifyAbsolute)));
ret += "\n\t-$(SYMLINK) $(TARGET) " + dst_link;
diff --git a/qmake/generators/unix/unixmake.h b/qmake/generators/unix/unixmake.h
index 1f32e4341f..92f118a143 100644
--- a/qmake/generators/unix/unixmake.h
+++ b/qmake/generators/unix/unixmake.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** 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) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef UNIXMAKE_H
#define UNIXMAKE_H
@@ -58,7 +33,7 @@ protected:
void writeSubTargets(QTextStream &t, QList<SubTarget*> subtargets, int flags) override;
void writeMakeParts(QTextStream &);
bool writeMakefile(QTextStream &) override;
- std::pair<bool, QString> writeObjectsPart(QTextStream &, bool do_incremental);
+ bool writeObjectsPart(QTextStream &, bool do_incremental);
private:
void init2();
ProStringList libdirToFlags(const ProKey &key);
diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp
index d5a057ef7b..96036eba70 100644
--- a/qmake/generators/unix/unixmake2.cpp
+++ b/qmake/generators/unix/unixmake2.cpp
@@ -1,31 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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) 2016 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 "unixmake.h"
#include "option.h"
@@ -35,6 +10,7 @@
#include <qfile.h>
#include <qdir.h>
#include <qdebug.h>
+#include <qtversion.h>
#include <time.h>
#include <tuple>
@@ -129,11 +105,11 @@ UnixMakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::
if (!out_directory.isEmpty() && !out_directory.endsWith(Option::dir_sep))
out_directory += Option::dir_sep;
if (!abs_source_path.isEmpty() && out_directory.startsWith(abs_source_path))
- out_directory = Option::output_dir + out_directory.mid(abs_source_path.length());
+ out_directory = Option::output_dir + out_directory.mid(abs_source_path.size());
QString dist_directory = out_directory;
if (dist_directory.endsWith(Option::dir_sep))
- dist_directory.chop(Option::dir_sep.length());
+ dist_directory.chop(Option::dir_sep.size());
if (!dist_directory.startsWith(Option::dir_sep))
dist_directory.prepend(Option::dir_sep);
@@ -145,7 +121,7 @@ UnixMakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::
QString out = subtarget->makefile;
QString in = escapeFilePath(fileFixify(in_directory + subtarget->profile, FileFixifyAbsolute));
if (out.startsWith(in_directory))
- out.remove(0, in_directory.length());
+ out.remove(0, in_directory.size());
t << subtarget->target << "-distdir: FORCE";
writeSubTargetCall(t, in_directory, in, out_directory, escapeFilePath(out),
@@ -244,8 +220,8 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
t << "####### Files\n\n";
// This is used by the dist target.
t << "SOURCES = " << fileVarList("SOURCES") << ' ' << fileVarList("GENERATED_SOURCES") << Qt::endl;
- auto objectParts = writeObjectsPart(t, do_incremental);
- src_incremental = objectParts.first;
+
+ src_incremental = writeObjectsPart(t, do_incremental);
if(do_incremental && !src_incremental)
do_incremental = false;
t << "DIST = " << valList(fileFixify(project->values("DISTFILES").toQStringList())) << " "
@@ -327,7 +303,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
for(QStringList::Iterator cit = Option::c_ext.begin();
cit != Option::c_ext.end(); ++cit) {
if((*it).endsWith((*cit))) {
- d_file = (*it).left((*it).length() - (*cit).length()).toQString();
+ d_file = (*it).left((*it).length() - (*cit).size()).toQString();
break;
}
}
@@ -335,7 +311,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
for(QStringList::Iterator cppit = Option::cpp_ext.begin();
cppit != Option::cpp_ext.end(); ++cppit) {
if((*it).endsWith((*cppit))) {
- d_file = (*it).left((*it).length() - (*cppit).length()).toQString();
+ d_file = (*it).left((*it).length() - (*cppit).size()).toQString();
break;
}
}
@@ -395,6 +371,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
}
}
}
+ LinkerResponseFileInfo linkerResponseFile = maybeCreateLinkerResponseFile();
QString deps = escapeDependencyPath(fileFixify(Option::output.fileName()));
QString allDeps;
if (!project->values("QMAKE_APP_FLAG").isEmpty() || project->first("TEMPLATE") == "aux") {
@@ -411,7 +388,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
//incremental target
QString incr_target = var("TARGET") + "_incremental";
if(incr_target.indexOf(Option::dir_sep) != -1)
- incr_target = incr_target.right(incr_target.length() -
+ incr_target = incr_target.right(incr_target.size() -
(incr_target.lastIndexOf(Option::dir_sep) + 1));
QString incr_deps, incr_objs;
if(project->first("QMAKE_INCREMENTAL_STYLE") == "ld") {
@@ -481,8 +458,13 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
t << mkdir_p_asstring(destdir) << "\n\t";
if (!project->isEmpty("QMAKE_PRE_LINK"))
t << var("QMAKE_PRE_LINK") << "\n\t";
- t << "$(LINK) $(LFLAGS) " << var("QMAKE_LINK_O_FLAG") << "$(TARGET) "
- << objectParts.second << " $(OBJCOMP) $(LIBS)";
+ t << "$(LINK) $(LFLAGS) " << var("QMAKE_LINK_O_FLAG") << "$(TARGET) ";
+ if (!linkerResponseFile.isValid())
+ t << " $(OBJECTS) $(OBJCOMP) $(LIBS)";
+ else if (linkerResponseFile.onlyObjects)
+ t << " @" << linkerResponseFile.filePath << " $(OBJCOMP) $(LIBS)";
+ else
+ t << " $(OBJCOMP) @" << linkerResponseFile.filePath;
if (!project->isEmpty("QMAKE_POST_LINK"))
t << "\n\t" << var("QMAKE_POST_LINK");
}
@@ -507,7 +489,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
QString incr_target = var("QMAKE_ORIG_TARGET").replace(
QRegularExpression("\\." + s_ext), "").replace(QRegularExpression("^lib"), "") + "_incremental";
if(incr_target.indexOf(Option::dir_sep) != -1)
- incr_target = incr_target.right(incr_target.length() -
+ incr_target = incr_target.right(incr_target.size() -
(incr_target.lastIndexOf(Option::dir_sep) + 1));
if(project->first("QMAKE_INCREMENTAL_STYLE") == "ld") {
@@ -557,7 +539,10 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
<< incr_deps << " $(SUBLIBS) " << target_deps << ' ' << depVar("POST_TARGETDEPS");
} else {
ProStringList &cmd = project->values("QMAKE_LINK_SHLIB_CMD");
- cmd[0] = cmd.at(0).toQString().replace(QLatin1String("$(OBJECTS)"), objectParts.second);
+ if (linkerResponseFile.isValid()) {
+ cmd[0] = cmd.at(0).toQString().replace(QLatin1String("$(OBJECTS)"),
+ "@" + linkerResponseFile.filePath);
+ }
t << destdir_d << depVar("TARGET") << ": " << depVar("PRE_TARGETDEPS")
<< " $(OBJECTS) $(SUBLIBS) $(OBJCOMP) " << target_deps
<< ' ' << depVar("POST_TARGETDEPS");
@@ -819,18 +804,19 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
QString icon = fileFixify(var("ICON"));
t << "@$(DEL_FILE) " << info_plist_out << "\n\t"
- << "@sed ";
- for (const ProString &arg : qAsConst(commonSedArgs))
+ << "@plutil -convert xml1 -o - " << info_plist << " | "
+ << "sed ";
+ for (const ProString &arg : std::as_const(commonSedArgs))
t << arg;
const QString iconName = icon.section(Option::dir_sep, -1);
t << "-e \"s,@ICON@," << iconName << ",g\" "
<< "-e \"s,\\$${ASSETCATALOG_COMPILER_APPICON_NAME}," << iconName << ",g\" "
<< "-e \"s,@EXECUTABLE@," << app_bundle_name << ",g\" "
<< "-e \"s,@LIBRARY@," << plugin_bundle_name << ",g\" "
- << "-e \"s,\\$${EXECUTABLE_NAME}," << (app_bundle_name.isEmpty() ? app_bundle_name : plugin_bundle_name) << ",g\" "
+ << "-e \"s,\\$${EXECUTABLE_NAME}," << (!app_bundle_name.isEmpty() ? app_bundle_name : plugin_bundle_name) << ",g\" "
<< "-e \"s,@TYPEINFO@,"<< typeInfo << ",g\" "
<< "-e \"s,\\$${QMAKE_PKGINFO_TYPEINFO},"<< typeInfo << ",g\" "
- << "" << info_plist << " >" << info_plist_out << Qt::endl;
+ << ">" << info_plist_out << Qt::endl;
//copy the icon
if (!project->isEmpty("ICON")) {
QString dir = bundle_dir + "Contents/Resources/";
@@ -851,21 +837,22 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
if (!isShallowBundle)
symlinks[bundle_dir + "Resources"] = "Versions/Current/Resources";
t << "@$(DEL_FILE) " << info_plist_out << "\n\t"
- << "@sed ";
- for (const ProString &arg : qAsConst(commonSedArgs))
+ << "@plutil -convert xml1 -o - " << info_plist << " | "
+ << "sed ";
+ for (const ProString &arg : std::as_const(commonSedArgs))
t << arg;
t << "-e \"s,@LIBRARY@," << lib_bundle_name << ",g\" "
<< "-e \"s,\\$${EXECUTABLE_NAME}," << lib_bundle_name << ",g\" "
<< "-e \"s,@TYPEINFO@," << typeInfo << ",g\" "
<< "-e \"s,\\$${QMAKE_PKGINFO_TYPEINFO}," << typeInfo << ",g\" "
- << "" << info_plist << " >" << info_plist_out << Qt::endl;
+ << ">" << info_plist_out << Qt::endl;
}
break;
} // project->isActiveConfig("no_plist")
//copy other data
if(!project->isEmpty("QMAKE_BUNDLE_DATA")) {
const ProStringList &bundle_data = project->values("QMAKE_BUNDLE_DATA");
- for(int i = 0; i < bundle_data.count(); i++) {
+ for(int i = 0; i < bundle_data.size(); i++) {
const ProStringList &files = project->values(ProKey(bundle_data[i] + ".files"));
QString path = bundle_dir;
const ProKey pkey(bundle_data[i] + ".path");
@@ -885,7 +872,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
}
path += project->first(pkey).toQString();
path = Option::fixPathToTargetOS(path);
- for(int file = 0; file < files.count(); file++) {
+ for(int file = 0; file < files.size(); file++) {
QString fn = files.at(file).toQString();
QString src = fileFixify(fn, FileFixifyAbsolute);
if (!QFile::exists(src))
@@ -992,7 +979,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
ProStringList pchArchs = project->values("QMAKE_PCH_ARCHS");
if (pchArchs.isEmpty())
pchArchs << ProString(); // normal single-arch PCH
- for (const ProString &arch : qAsConst(pchArchs)) {
+ for (const ProString &arch : std::as_const(pchArchs)) {
ProString pchOutput;
if (!project->isEmpty("PRECOMPILED_DIR"))
pchOutput = project->first("PRECOMPILED_DIR");
@@ -1023,7 +1010,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
ProStringList pchArchs = project->values("QMAKE_PCH_ARCHS");
if (pchArchs.isEmpty())
pchArchs << ProString(); // normal single-arch PCH
- for (const ProString &arch : qAsConst(pchArchs)) {
+ for (const ProString &arch : std::as_const(pchArchs)) {
QString file = precomph_out_dir + header_prefix + language + header_suffix;
if (!arch.isEmpty())
file.replace(QStringLiteral("${QMAKE_PCH_ARCH}"), arch.toQString());
@@ -1121,7 +1108,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
}
pchFlags.replace(QLatin1String("${QMAKE_PCH_INPUT}"), escapeFilePath(pchInput))
.replace(QLatin1String("${QMAKE_PCH_OUTPUT_BASE}"), escapeFilePath(pchBaseName.toQString()));
- for (const ProString &arch : qAsConst(pchArchs)) {
+ for (const ProString &arch : std::as_const(pchArchs)) {
auto pchArchOutput = pchOutput.toQString();
if (!arch.isEmpty())
pchArchOutput.replace(QStringLiteral("${QMAKE_PCH_ARCH}"), arch.toQString());
@@ -1410,7 +1397,7 @@ UnixMakefileGenerator::libtoolFileName(bool fixify)
QString ret = var("TARGET");
int slsh = ret.lastIndexOf(Option::dir_sep);
if(slsh != -1)
- ret = ret.right(ret.length() - slsh - 1);
+ ret = ret.right(ret.size() - slsh - 1);
int dot = ret.indexOf('.');
if(dot != -1)
ret = ret.left(dot);
@@ -1480,7 +1467,7 @@ UnixMakefileGenerator::writeLibtoolFile()
mkdir(fileInfo(fname).path());
int slsh = lname.lastIndexOf(Option::dir_sep);
if(slsh != -1)
- lname = lname.right(lname.length() - slsh - 1);
+ lname = lname.right(lname.size() - slsh - 1);
QFile ft(fname);
if(!ft.open(QIODevice::WriteOnly))
return;
@@ -1510,7 +1497,7 @@ UnixMakefileGenerator::writeLibtoolFile()
t << "'\n\n";
t << "# The name of the static archive.\n"
- << "old_library='" << escapeFilePath(lname.left(lname.length()-Option::libtool_ext.length()))
+ << "old_library='" << escapeFilePath(lname.left(lname.size()-Option::libtool_ext.size()))
<< ".a'\n\n";
t << "# Libraries that this one depends upon.\n";
@@ -1550,7 +1537,7 @@ UnixMakefileGenerator::writeLibtoolFile()
"libdir='" << Option::fixPathToTargetOS(install_dir.toQString(), false) << "'\n";
}
-std::pair<bool, QString> UnixMakefileGenerator::writeObjectsPart(QTextStream &t, bool do_incremental)
+bool UnixMakefileGenerator::writeObjectsPart(QTextStream &t, bool do_incremental)
{
bool src_incremental = false;
QString objectsLinkLine;
@@ -1573,9 +1560,9 @@ std::pair<bool, QString> UnixMakefileGenerator::writeObjectsPart(QTextStream &t,
if (!increment)
t << "\\\n\t\t" << (*objit);
}
- if (incrs_out.count() == objs.count()) { //we just switched places, no real incrementals to be done!
+ if (incrs_out.size() == objs.size()) { //we just switched places, no real incrementals to be done!
t << escapeFilePaths(incrs_out).join(QString(" \\\n\t\t")) << Qt::endl;
- } else if (!incrs_out.count()) {
+ } else if (!incrs_out.size()) {
t << Qt::endl;
} else {
src_incremental = true;
@@ -1584,18 +1571,9 @@ std::pair<bool, QString> UnixMakefileGenerator::writeObjectsPart(QTextStream &t,
<< escapeFilePaths(incrs_out).join(QString(" \\\n\t\t")) << Qt::endl;
}
} else {
- const ProString &objMax = project->first("QMAKE_LINK_OBJECT_MAX");
- // Used all over the place in both deps and commands.
- if (objMax.isEmpty() || project->values("OBJECTS").count() < objMax.toInt()) {
- objectsLinkLine = "$(OBJECTS)";
- } else {
- const QString ld_response_file = createResponseFile(
- fileVar("OBJECTS_DIR") + var("QMAKE_LINK_OBJECT_SCRIPT"), objs);
- objectsLinkLine = "@" + escapeFilePath(ld_response_file);
- }
t << "OBJECTS = " << valList(escapeDependencyPaths(objs)) << Qt::endl;
}
- return std::make_pair(src_incremental, objectsLinkLine);
+ return src_incremental;
}
QT_END_NAMESPACE
diff --git a/qmake/generators/win32/mingw_make.cpp b/qmake/generators/win32/mingw_make.cpp
index 823b799eb2..7f798a2cc6 100644
--- a/qmake/generators/win32/mingw_make.cpp
+++ b/qmake/generators/win32/mingw_make.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** 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) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "mingw_make.h"
#include "option.h"
@@ -216,7 +191,7 @@ void MingwMakefileGenerator::writeIncPart(QTextStream &t)
return;
}
}
- for (const ProString &incit: qAsConst(incs)) {
+ for (const ProString &incit: std::as_const(incs)) {
QString inc = incit.toQString();
inc.replace(QRegularExpression("\\\\$"), "");
inc.replace('\\', '/');
@@ -242,21 +217,18 @@ void MingwMakefileGenerator::writeLibsPart(QTextStream &t)
void MingwMakefileGenerator::writeObjectsPart(QTextStream &t)
{
- const ProString &objmax = project->first("QMAKE_LINK_OBJECT_MAX");
- if (objmax.isEmpty() || project->values("OBJECTS").count() < objmax.toInt()) {
+ linkerResponseFile = maybeCreateLinkerResponseFile();
+ if (!linkerResponseFile.isValid()) {
objectsLinkLine = "$(OBJECTS)";
} else if (project->isActiveConfig("staticlib") && project->first("TEMPLATE") == "lib") {
// QMAKE_LIB is used for win32, including mingw, whereas QMAKE_AR is used on Unix.
QString ar_cmd = var("QMAKE_LIB");
if (ar_cmd.isEmpty())
ar_cmd = "ar -rc";
- const QString ar_response_file =
- createResponseFile(var("QMAKE_LINK_OBJECT_SCRIPT"), project->values("OBJECTS"));
- objectsLinkLine = ar_cmd + ' ' + var("DEST_TARGET") + " @" + escapeFilePath(ar_response_file);
+ objectsLinkLine = ar_cmd + ' ' + var("DEST_TARGET") + " @"
+ + escapeFilePath(linkerResponseFile.filePath);
} else {
- const QString ld_response_file =
- createResponseFile(var("QMAKE_LINK_OBJECT_SCRIPT"), project->values("OBJECTS"));
- objectsLinkLine = "@" + escapeFilePath(ld_response_file);
+ objectsLinkLine = "@" + escapeFilePath(linkerResponseFile.filePath);
}
Win32MakefileGenerator::writeObjectsPart(t);
}
@@ -278,13 +250,16 @@ void MingwMakefileGenerator::writeBuildRulesPart(QTextStream &t)
if(project->isActiveConfig("staticlib") && project->first("TEMPLATE") == "lib") {
t << "\n\t-$(DEL_FILE) $(DESTDIR_TARGET) 2>" << var("QMAKE_SHELL_NULL_DEVICE");
const ProString &objmax = project->first("QMAKE_LINK_OBJECT_MAX");
- if (objmax.isEmpty() || project->values("OBJECTS").count() < objmax.toInt()) {
+ if (objmax.isEmpty() || project->values("OBJECTS").size() < objmax.toInt()) {
t << "\n\t$(LIB) $(DESTDIR_TARGET) " << objectsLinkLine << " " ;
} else {
t << "\n\t" << objectsLinkLine << " " ;
}
} else {
- t << "\n\t$(LINKER) $(LFLAGS) " << var("QMAKE_LINK_O_FLAG") << "$(DESTDIR_TARGET) " << objectsLinkLine << " $(LIBS)";
+ t << "\n\t$(LINKER) $(LFLAGS) " << var("QMAKE_LINK_O_FLAG") << "$(DESTDIR_TARGET) "
+ << objectsLinkLine;
+ if (!linkerResponseFile.isValid() || linkerResponseFile.onlyObjects)
+ t << " $(LIBS)";
}
if(!project->isEmpty("QMAKE_POST_LINK"))
t << "\n\t" <<var("QMAKE_POST_LINK");
@@ -298,7 +273,7 @@ void MingwMakefileGenerator::writeRcFilePart(QTextStream &t)
ProStringList rcIncPaths = project->values("RC_INCLUDEPATH");
rcIncPaths.prepend(fileInfo(rc_file).path());
QString incPathStr;
- for (int i = 0; i < rcIncPaths.count(); ++i) {
+ for (int i = 0; i < rcIncPaths.size(); ++i) {
const ProString &path = rcIncPaths.at(i);
if (path.isEmpty())
continue;
diff --git a/qmake/generators/win32/mingw_make.h b/qmake/generators/win32/mingw_make.h
index 6c1f0086cc..8b919f97e7 100644
--- a/qmake/generators/win32/mingw_make.h
+++ b/qmake/generators/win32/mingw_make.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** 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) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef MINGW_MAKE_H
#define MINGW_MAKE_H
@@ -59,6 +34,7 @@ private:
LibFlagType parseLibFlag(const ProString &flag, ProString *arg) override;
QString objectsLinkLine;
+ LinkerResponseFileInfo linkerResponseFile;
};
QT_END_NAMESPACE
diff --git a/qmake/generators/win32/msbuild_objectmodel.cpp b/qmake/generators/win32/msbuild_objectmodel.cpp
index 97adc85237..9bbeed36ff 100644
--- a/qmake/generators/win32/msbuild_objectmodel.cpp
+++ b/qmake/generators/win32/msbuild_objectmodel.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** 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) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "msbuild_objectmodel.h"
@@ -35,6 +10,7 @@
#include <qstringlist.h>
#include <qfileinfo.h>
#include <qregularexpression.h>
+#include <qvarlengtharray.h>
QT_BEGIN_NAMESPACE
@@ -307,7 +283,7 @@ static QString commandLinesForOutput(QStringList commands)
// As we want every sub-command to be error-checked (as is done by makefile-based
// backends), we insert the checks ourselves, using the undocumented jump target.
static QString errchk = QStringLiteral("if errorlevel 1 goto VCEnd");
- for (int i = commands.count() - 2; i >= 0; --i) {
+ for (int i = commands.size() - 2; i >= 0; --i) {
if (!commands.at(i).startsWith("rem", Qt::CaseInsensitive))
commands.insert(i + 1, errchk);
}
@@ -325,7 +301,7 @@ static QStringList unquote(const QStringList &values)
{
QStringList result;
result.reserve(values.size());
- for (int i = 0; i < values.count(); ++i)
+ for (int i = 0; i < values.size(); ++i)
result << unquote(values.at(i));
return result;
}
@@ -536,7 +512,10 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProjectSingleConfig &tool)
QFile filterFile;
filterFile.setFileName(Option::output.fileName().append(".filters"));
- filterFile.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate);
+ if (!filterFile.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate)) {
+ warn_msg(WarnLogic, "Generator: cannot open output filter file");
+ return;
+ }
QTextStream ts(&filterFile);
XmlOutput xmlFilter(ts, XmlOutput::NoConversion);
@@ -568,7 +547,7 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProjectSingleConfig &tool)
[] (const VCFilter &filter) { return filter.Name; });
tempProj.ExtraCompilers.removeDuplicates();
- for (int x = 0; x < tempProj.ExtraCompilers.count(); ++x)
+ for (int x = 0; x < tempProj.ExtraCompilers.size(); ++x)
addFilters(tempProj, xmlFilter, tempProj.ExtraCompilers.at(x));
xmlFilter << closetag();
@@ -583,7 +562,7 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProjectSingleConfig &tool)
outputFilter(tempProj, xml, xmlFilter, "Deployment Files");
outputFilter(tempProj, xml, xmlFilter, "Distribution Files");
- for (int x = 0; x < tempProj.ExtraCompilers.count(); ++x) {
+ for (int x = 0; x < tempProj.ExtraCompilers.size(); ++x) {
outputFilter(tempProj, xml, xmlFilter, tempProj.ExtraCompilers.at(x));
}
@@ -598,7 +577,7 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProjectSingleConfig &tool)
void VCXProjectWriter::write(XmlOutput &xml, VCProject &tool)
{
- if (tool.SingleProjects.count() == 0) {
+ if (tool.SingleProjects.size() == 0) {
warn_msg(WarnLogic, "Generator: .NET: no single project in merge project, no output");
return;
}
@@ -613,7 +592,7 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProject &tool)
<< tag("ItemGroup")
<< attrTag("Label", "ProjectConfigurations");
- for (int i = 0; i < tool.SingleProjects.count(); ++i) {
+ for (int i = 0; i < tool.SingleProjects.size(); ++i) {
xml << tag("ProjectConfiguration")
<< attrTag("Include" , tool.SingleProjects.at(i).Configuration.Name)
<< tagValue("Configuration", tool.SingleProjects.at(i).Configuration.ConfigurationName)
@@ -637,7 +616,7 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProject &tool)
// config part.
xml << import("Project", "$(VCTargetsPath)\\Microsoft.Cpp.Default.props");
- for (int i = 0; i < tool.SingleProjects.count(); ++i)
+ for (int i = 0; i < tool.SingleProjects.size(); ++i)
write(xml, tool.SingleProjects.at(i).Configuration);
xml << import("Project", "$(VCTargetsPath)\\Microsoft.Cpp.props");
@@ -647,7 +626,7 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProject &tool)
<< closetag();
// PropertySheets
- for (int i = 0; i < tool.SingleProjects.count(); ++i) {
+ for (int i = 0; i < tool.SingleProjects.size(); ++i) {
xml << tag("ImportGroup")
<< attrTag("Condition", generateCondition(tool.SingleProjects.at(i).Configuration))
<< attrTag("Label", "PropertySheets");
@@ -665,7 +644,7 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProject &tool)
<< closetag();
xml << tag("PropertyGroup");
- for (int i = 0; i < tool.SingleProjects.count(); ++i) {
+ for (int i = 0; i < tool.SingleProjects.size(); ++i) {
const VCConfiguration &config = tool.SingleProjects.at(i).Configuration;
const QString condition = generateCondition(config);
@@ -732,7 +711,7 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProject &tool)
}
xml << closetag();
- for (int i = 0; i < tool.SingleProjects.count(); ++i) {
+ for (int i = 0; i < tool.SingleProjects.size(); ++i) {
const VCConfiguration &config = tool.SingleProjects.at(i).Configuration;
xml << tag("ItemDefinitionGroup")
@@ -775,7 +754,10 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProject &tool)
// The file filters are added in a separate file for MSBUILD.
QFile filterFile;
filterFile.setFileName(Option::output.fileName().append(".filters"));
- filterFile.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate);
+ if (!filterFile.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate)) {
+ warn_msg(WarnLogic, "Cannot open output filter file");
+ return;
+ }
QTextStream ts(&filterFile);
XmlOutput xmlFilter(ts, XmlOutput::NoConversion);
@@ -798,7 +780,7 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProject &tool)
addFilters(tool, xmlFilter, "Deployment Files");
addFilters(tool, xmlFilter, "Distribution Files");
- for (int x = 0; x < tool.ExtraCompilers.count(); ++x)
+ for (int x = 0; x < tool.ExtraCompilers.size(); ++x)
addFilters(tool, xmlFilter, tool.ExtraCompilers.at(x));
xmlFilter << closetag();
@@ -812,7 +794,7 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProject &tool)
outputFilter(tool, xml, xmlFilter, "Resource Files");
outputFilter(tool, xml, xmlFilter, "Deployment Files");
outputFilter(tool, xml, xmlFilter, "Distribution Files");
- for (int x = 0; x < tool.ExtraCompilers.count(); ++x) {
+ for (int x = 0; x < tool.ExtraCompilers.size(); ++x) {
outputFilter(tool, xml, xmlFilter, tool.ExtraCompilers.at(x));
}
outputFilter(tool, xml, xmlFilter, "Root Files");
@@ -1088,6 +1070,8 @@ static inline QString toString(optLinkTimeCodeGenType option)
break;
case optLTCGEnabled:
return "UseLinkTimeCodeGeneration";
+ case optLTCGIncremental:
+ return "UseFastLinkTimeCodeGeneration";
case optLTCGInstrument:
return "PGInstrument";
case optLTCGOptimize:
@@ -1121,6 +1105,8 @@ static inline QString toString(triState genDebugInfo, linkerDebugOption option)
case _True:
if (option == linkerDebugOptionFastLink)
return "DebugFastLink";
+ else if (option == linkerDebugOptionFull)
+ return "DebugFull";
return "true";
}
return QString();
@@ -1757,7 +1743,7 @@ void VCXProjectWriter::addFilters(VCProject &project, XmlOutput &xmlFilter, cons
{
bool added = false;
- for (int i = 0; i < project.SingleProjects.count(); ++i) {
+ for (int i = 0; i < project.SingleProjects.size(); ++i) {
const VCFilter filter = project.SingleProjects.at(i).filterByName(filtername);
if(!filter.Files.isEmpty() && !added) {
xmlFilter << tag("Filter")
@@ -1779,10 +1765,10 @@ void VCXProjectWriter::outputFilter(VCProject &project, XmlOutput &xml, XmlOutpu
else
root.reset(new XTreeNode);
- for (int i = 0; i < project.SingleProjects.count(); ++i) {
+ for (int i = 0; i < project.SingleProjects.size(); ++i) {
const VCFilter filter = project.SingleProjects.at(i).filterByName(filtername);
// Merge all files in this filter to root tree
- for (int x = 0; x < filter.Files.count(); ++x)
+ for (int x = 0; x < filter.Files.size(); ++x)
root->addElement(filter.Files.at(x));
}
@@ -1809,8 +1795,8 @@ void VCXProjectWriter::outputFileConfigs(VCProject &project, XmlOutput &xml, Xml
// We need to check if the file has any custom build step.
// If there is one then it has to be included with "CustomBuild Include"
bool hasCustomBuildStep = false;
- QVarLengthArray<OutputFilterData> data(project.SingleProjects.count());
- for (int i = 0; i < project.SingleProjects.count(); ++i) {
+ QVarLengthArray<OutputFilterData> data(project.SingleProjects.size());
+ for (int i = 0; i < project.SingleProjects.size(); ++i) {
data[i].filter = project.SingleProjects.at(i).filterByName(cleanFilterName);
if (!data[i].filter.Config) // only if the filter is not empty
continue;
@@ -1832,7 +1818,7 @@ void VCXProjectWriter::outputFileConfigs(VCProject &project, XmlOutput &xml, Xml
}
bool fileAdded = false;
- for (int i = 0; i < project.SingleProjects.count(); ++i) {
+ for (int i = 0; i < project.SingleProjects.size(); ++i) {
OutputFilterData *d = &data[i];
if (!d->filter.Config) // only if the filter is not empty
continue;
diff --git a/qmake/generators/win32/msbuild_objectmodel.h b/qmake/generators/win32/msbuild_objectmodel.h
index ce5711f2da..3d96a030e9 100644
--- a/qmake/generators/win32/msbuild_objectmodel.h
+++ b/qmake/generators/win32/msbuild_objectmodel.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** 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) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef MSBUILD_OBJECTMODEL_H
#define MSBUILD_OBJECTMODEL_H
diff --git a/qmake/generators/win32/msvc_nmake.cpp b/qmake/generators/win32/msvc_nmake.cpp
index 50666215c6..b5df617927 100644
--- a/qmake/generators/win32/msvc_nmake.cpp
+++ b/qmake/generators/win32/msvc_nmake.cpp
@@ -1,37 +1,12 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** 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) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "msvc_nmake.h"
#include "option.h"
#include <qregularexpression.h>
#include <qdir.h>
-#include <qdiriterator.h>
+#include <qdirlisting.h>
#include <qset.h>
#include <time.h>
@@ -174,6 +149,10 @@ QString NmakeMakefileGenerator::var(const ProKey &value) const
return MakefileGenerator::var(value);
}
+void NmakeMakefileGenerator::suppressBuiltinRules(QTextStream &) const
+{
+}
+
void NmakeMakefileGenerator::init()
{
/* this should probably not be here, but I'm using it to wrap the .t files */
@@ -285,9 +264,9 @@ QStringList NmakeMakefileGenerator::sourceFilesForImplicitRulesFilter()
{
QStringList filter;
const QChar wildcard = QLatin1Char('*');
- for (const QString &ext : qAsConst(Option::c_ext))
+ for (const QString &ext : std::as_const(Option::c_ext))
filter << wildcard + ext;
- for (const QString &ext : qAsConst(Option::cpp_ext))
+ for (const QString &ext : std::as_const(Option::cpp_ext))
filter << wildcard + ext;
return filter;
}
@@ -311,7 +290,7 @@ void NmakeMakefileGenerator::writeImplicitRulesPart(QTextStream &t)
for (int y = 0; directories[y]; y++) {
QString dirTemp = project->first(directories[y]).toQString();
if (dirTemp.endsWith("\\"))
- dirTemp.truncate(dirTemp.length()-1);
+ dirTemp.truncate(dirTemp.size()-1);
if(!dirTemp.isEmpty())
source_directories.insert(dirTemp);
}
@@ -335,16 +314,15 @@ void NmakeMakefileGenerator::writeImplicitRulesPart(QTextStream &t)
const QStringList sourceFilesFilter = sourceFilesForImplicitRulesFilter();
QStringList fixifiedSourceDirs = fileFixify(QList<QString>(source_directories.constBegin(), source_directories.constEnd()), FileFixifyAbsolute);
fixifiedSourceDirs.removeDuplicates();
- for (const QString &sourceDir : qAsConst(fixifiedSourceDirs)) {
- QDirIterator dit(sourceDir, sourceFilesFilter, QDir::Files | QDir::NoDotAndDotDot);
- while (dit.hasNext()) {
- const QFileInfo fi = dit.nextFileInfo();
- QString &duplicate = fileNames[fi.completeBaseName()];
+ constexpr auto filters = QDir::Files | QDir::NoDotAndDotDot;
+ for (const QString &sourceDir : std::as_const(fixifiedSourceDirs)) {
+ for (const auto &dirEntry : QDirListing(sourceDir, sourceFilesFilter, filters)) {
+ QString &duplicate = fileNames[dirEntry.completeBaseName()];
if (duplicate.isNull()) {
- duplicate = fi.filePath();
+ duplicate = dirEntry.filePath();
} else {
warn_msg(WarnLogic, "%s conflicts with %s", qPrintable(duplicate),
- qPrintable(fi.filePath()));
+ qPrintable(dirEntry.filePath()));
duplicatesFound = true;
}
}
@@ -360,7 +338,7 @@ void NmakeMakefileGenerator::writeImplicitRulesPart(QTextStream &t)
project->variables().remove("QMAKE_RUN_CXX");
project->variables().remove("QMAKE_RUN_CC");
- for (const QString &sourceDir : qAsConst(source_directories)) {
+ for (const QString &sourceDir : std::as_const(source_directories)) {
if (sourceDir.isEmpty())
continue;
QString objDir = var("OBJECTS_DIR");
diff --git a/qmake/generators/win32/msvc_nmake.h b/qmake/generators/win32/msvc_nmake.h
index 3064f06521..8839a24c65 100644
--- a/qmake/generators/win32/msvc_nmake.h
+++ b/qmake/generators/win32/msvc_nmake.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** 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) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef MSVC_NMAKE_H
#define MSVC_NMAKE_H
@@ -52,6 +27,7 @@ protected:
QString defaultInstall(const QString &t) override;
QStringList &findDependencies(const QString &file) override;
QString var(const ProKey &value) const override;
+ void suppressBuiltinRules(QTextStream &t) const override;
QString precompH, precompObj, precompPch;
QString precompObjC, precompPchC;
bool usePCH = false;
diff --git a/qmake/generators/win32/msvc_objectmodel.cpp b/qmake/generators/win32/msvc_objectmodel.cpp
index a18eb076bd..6517e5c451 100644
--- a/qmake/generators/win32/msvc_objectmodel.cpp
+++ b/qmake/generators/win32/msvc_objectmodel.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** 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) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "msvc_objectmodel.h"
#include "msvc_vcproj.h"
@@ -336,14 +311,12 @@ static QString vcCommandSeparator()
// of the custom commands into it, and putting an "if errorlevel goto" statement behind it.
// As we want every sub-command to be error-checked (as is done by makefile-based
// backends), we insert the checks ourselves, using the undocumented jump target.
- static QString cmdSep =
- QLatin1String("&#x000D;&#x000A;if errorlevel 1 goto VCReportError&#x000D;&#x000A;");
- return cmdSep;
+ return QStringLiteral("&#x000D;&#x000A;if errorlevel 1 goto VCReportError&#x000D;&#x000A;");
}
static void unknownOptionWarning(const char *tool, const char *option)
{
- static bool firstCall = true;
+ Q_CONSTINIT static bool firstCall = true;
warn_msg(WarnLogic, "Could not parse %s option '%s'; added to AdditionalOptions.", tool, option);
if (firstCall) {
firstCall = false;
@@ -410,7 +383,7 @@ VCCLCompilerTool::VCCLCompilerTool()
CompileForArchitecture(archUnknown),
InterworkCalls(unset),
EnablePREfast(unset),
- DisplayFullPaths(unset),
+ DisplayFullPaths(_False),
MultiProcessorCompilation(unset),
GenerateXMLDocumentationFiles(unset),
CreateHotpatchableImage(unset)
@@ -889,7 +862,7 @@ bool VCCLCompilerTool::parseOption(const char* option)
}
break;
}
- // Fallthrough
+ [[fallthrough]];
default:
found = false; break;
}
@@ -1504,10 +1477,23 @@ bool VCLinkerTool::parseOption(const char* option)
}else
EnableUAC = _True;
break;
- case 0x3389797: // /DEBUG[:FASTLINK]
- GenerateDebugInformation = _True;
- if (config->CompilerVersion >= NET2015 && strcmp(option + 7, "FASTLINK") == 0)
- DebugInfoOption = linkerDebugOptionFastLink;
+ case 0x3389797: // /DEBUG[:{FASTLINK|FULL|NONE}]
+ DebugInfoOption = linkerDebugOptionEnabled;
+ if (config->CompilerVersion >= NET2015 && *(option + 6) == ':') {
+ const char *str = option + 7;
+ if (qstricmp(str, "fastlink") == 0)
+ DebugInfoOption = linkerDebugOptionFastLink;
+ else if (qstricmp(str, "full") == 0)
+ DebugInfoOption = linkerDebugOptionFull;
+ else if (qstricmp(str, "none") == 0)
+ DebugInfoOption = linkerDebugOptionNone;
+ else
+ AdditionalOptions += option;
+ }
+ if (DebugInfoOption == linkerDebugOptionNone)
+ GenerateDebugInformation = _False;
+ else
+ GenerateDebugInformation = _True;
break;
case 0x0033896: // /DEF:filename
ModuleDefinitionFile = option+5;
@@ -1554,7 +1540,7 @@ bool VCLinkerTool::parseOption(const char* option)
{
QStringList both = QString(option+6).split(",");
HeapReserveSize = both[0].toLongLong();
- if(both.count() == 2)
+ if(both.size() == 2)
HeapCommitSize = both[1].toLongLong();
}
break;
@@ -1594,24 +1580,28 @@ bool VCLinkerTool::parseOption(const char* option)
case 0x0d745c8: // /LIBPATH:dir
AdditionalLibraryDirectories += option+9;
break;
- case 0x0341877: // /LTCG[:NOSTATUS|:STATUS]
- config->WholeProgramOptimization = _True;
- if (config->CompilerVersion >= NET2005) {
- LinkTimeCodeGeneration = optLTCGEnabled;
- if(*(option+5) == ':') {
- const char* str = option+6;
- if (*str == 'S')
- ShowProgress = linkProgressAll;
- else if (qstricmp(str, "pginstrument") == 0)
- LinkTimeCodeGeneration = optLTCGInstrument;
- else if (qstricmp(str, "pgoptimize") == 0)
- LinkTimeCodeGeneration = optLTCGOptimize;
- else if (qstricmp(str, "pgupdate") == 0)
- LinkTimeCodeGeneration = optLTCGUpdate;
- }
- } else {
- AdditionalOptions.append(option);
+ case 0x0341877: // /LTCG[:{INCREMENTAL|NOSTATUS|STATUS|OFF}]
+ // /LTCG:{PGINSTRUMENT|PGOPTIMIZE|PGUPDATE}
+ LinkTimeCodeGeneration = optLTCGEnabled;
+ if (*(option + 5) == ':') {
+ const char* str = option + 6;
+ if (qstricmp(str, "status") == 0)
+ ShowProgress = linkProgressAll;
+ else if (qstricmp(str, "off") == 0)
+ LinkTimeCodeGeneration = optLTCGDefault;
+ else if (qstricmp(str, "incremental") == 0)
+ LinkTimeCodeGeneration = optLTCGIncremental;
+ else if (qstricmp(str, "pginstrument") == 0)
+ LinkTimeCodeGeneration = optLTCGInstrument;
+ else if (qstricmp(str, "pgoptimize") == 0)
+ LinkTimeCodeGeneration = optLTCGOptimize;
+ else if (qstricmp(str, "pgupdate") == 0)
+ LinkTimeCodeGeneration = optLTCGUpdate;
+ else
+ AdditionalOptions.append(option);
}
+ if (LinkTimeCodeGeneration != optLTCGDefault)
+ config->WholeProgramOptimization = _True;
break;
case 0x379ED25:
case 0x157cf65: // /MACHINE:{AM33|ARM|CEE|IA64|X86|M32R|MIPS|MIPS16|MIPSFPU|MIPSFPU16|MIPSR41XX|PPC|SH3|SH4|SH5|THUMB|TRICORE}
@@ -1739,7 +1729,7 @@ bool VCLinkerTool::parseOption(const char* option)
{
QStringList both = QString(option+7).split(",");
StackReserveSize = both[0].toLongLong();
- if(both.count() == 2)
+ if(both.size() == 2)
StackCommitSize = both[1].toLongLong();
}
break;
@@ -2242,13 +2232,13 @@ void VCFilter::addFile(const VCFilterFile& fileInfo)
void VCFilter::addFiles(const QStringList& fileList)
{
- for (int i = 0; i < fileList.count(); ++i)
+ for (int i = 0; i < fileList.size(); ++i)
addFile(fileList.at(i));
}
void VCFilter::addFiles(const ProStringList& fileList)
{
- for (int i = 0; i < fileList.count(); ++i)
+ for (int i = 0; i < fileList.size(); ++i)
addFile(fileList.at(i).toQString());
}
@@ -2282,7 +2272,7 @@ void VCFilter::modifyPCHstage(QString str)
lines << "* WARNING: All changes made in this file will be lost.";
lines << "--------------------------------------------------------------------*/";
lines << "#include \"" + Project->precompHFilename + "\"";
- for (const QString &line : qAsConst(lines))
+ for (const QString &line : std::as_const(lines))
CustomBuildTool.CommandLine += "echo " + line + ">>" + toFile;
return;
}
@@ -2315,7 +2305,7 @@ void VCFilter::modifyPCHstage(QString str)
VCFilterFile VCFilter::findFile(const QString &filePath, bool *found) const
{
- for (int i = 0; i < Files.count(); ++i) {
+ for (int i = 0; i < Files.size(); ++i) {
const VCFilterFile &f = Files.at(i);
if (f.file == filePath) {
*found = true;
@@ -2341,7 +2331,7 @@ bool VCFilter::addExtraCompiler(const VCFilterFile &info)
hasBuiltIn = Project->hasBuiltinCompiler(objectMappedFile);
// Remove the fake file suffix we've added initially to generate correct command lines.
- inFile.chop(Project->customBuildToolFilterFileSuffix.length());
+ inFile.chop(Project->customBuildToolFilterFileSuffix.size());
// qDebug("*** Extra compiler file has object mapped file '%s' => '%s'", qPrintable(inFile), qPrintable(objectMappedFile.join(' ')));
}
@@ -2353,7 +2343,7 @@ bool VCFilter::addExtraCompiler(const VCFilterFile &info)
CustomBuildTool.ToolPath.clear();
CustomBuildTool.ToolName = QLatin1String(_VCCustomBuildTool);
- for (int x = 0; x < extraCompilers.count(); ++x) {
+ for (int x = 0; x < extraCompilers.size(); ++x) {
const QString &extraCompilerName = extraCompilers.at(x);
if (!Project->verifyExtraCompiler(extraCompilerName, inFile) && !hasBuiltIn)
@@ -2398,7 +2388,7 @@ bool VCFilter::addExtraCompiler(const VCFilterFile &info)
configs.contains("dep_existing_only"),
true /* checkCommandAvailability */);
}
- for (int i = 0; i < deps.count(); ++i)
+ for (int i = 0; i < deps.size(); ++i)
deps[i] = Option::fixPathToTargetOS(
Project->replaceExtraCompilerVariables(
deps.at(i), inFile, out, MakefileGenerator::NoShell),
@@ -2407,9 +2397,9 @@ bool VCFilter::addExtraCompiler(const VCFilterFile &info)
if (combined) {
// Add dependencies for each file
const ProStringList &tmp_in = Project->project->values(ProKey(extraCompilerName + ".input"));
- for (int a = 0; a < tmp_in.count(); ++a) {
+ for (int a = 0; a < tmp_in.size(); ++a) {
const ProStringList &files = Project->project->values(tmp_in.at(a).toKey());
- for (int b = 0; b < files.count(); ++b) {
+ for (int b = 0; b < files.size(); ++b) {
QString file = files.at(b).toQString();
deps += Project->findDependencies(file);
inputs += Option::fixPathToTargetOS(file, false);
@@ -2443,7 +2433,7 @@ bool VCFilter::addExtraCompiler(const VCFilterFile &info)
}
// Fixify paths
- for (int i = 0; i < deps.count(); ++i)
+ for (int i = 0; i < deps.size(); ++i)
deps[i] = Option::fixPathToTargetOS(deps[i], false);
@@ -2461,7 +2451,7 @@ bool VCFilter::addExtraCompiler(const VCFilterFile &info)
deps += CustomBuildTool.AdditionalDependencies;
// Make sure that all deps are only once
QStringList uniqDeps;
- for (int c = 0; c < deps.count(); ++c) {
+ for (int c = 0; c < deps.size(); ++c) {
QString aDep = deps.at(c);
if (!aDep.isEmpty())
uniqDeps << aDep;
@@ -2472,7 +2462,7 @@ bool VCFilter::addExtraCompiler(const VCFilterFile &info)
// Ensure that none of the output files are also dependencies. Or else, the custom buildstep
// will be rebuild every time, even if nothing has changed.
- for (const QString &output : qAsConst(CustomBuildTool.Outputs))
+ for (const QString &output : std::as_const(CustomBuildTool.Outputs))
CustomBuildTool.AdditionalDependencies.removeAll(output);
useCustomBuildTool = !CustomBuildTool.CommandLine.isEmpty();
@@ -2507,7 +2497,7 @@ const VCFilter &VCProjectSingleConfig::filterByName(const QString &name) const
const VCFilter &VCProjectSingleConfig::filterForExtraCompiler(const QString &compilerName) const
{
- for (int i = 0; i < ExtraCompilersFiles.count(); ++i)
+ for (int i = 0; i < ExtraCompilersFiles.size(); ++i)
if (ExtraCompilersFiles.at(i).Name == compilerName)
return ExtraCompilersFiles.at(i);
@@ -2587,7 +2577,7 @@ void VCProjectWriter::write(XmlOutput &xml, VCProjectSingleConfig &tool)
outputFilter(tempProj, xml, "Distribution Files");
QSet<QString> extraCompilersInProject;
- for (int i = 0; i < tool.ExtraCompilersFiles.count(); ++i) {
+ for (int i = 0; i < tool.ExtraCompilersFiles.size(); ++i) {
const QString &compilerName = tool.ExtraCompilersFiles.at(i).Name;
if (!extraCompilersInProject.contains(compilerName)) {
extraCompilersInProject += compilerName;
@@ -2595,7 +2585,7 @@ void VCProjectWriter::write(XmlOutput &xml, VCProjectSingleConfig &tool)
}
}
- for (int x = 0; x < tempProj.ExtraCompilers.count(); ++x) {
+ for (int x = 0; x < tempProj.ExtraCompilers.size(); ++x) {
outputFilter(tempProj, xml, tempProj.ExtraCompilers.at(x));
}
outputFilter(tempProj, xml, "Root Files");
@@ -2606,7 +2596,7 @@ void VCProjectWriter::write(XmlOutput &xml, VCProjectSingleConfig &tool)
void VCProjectWriter::write(XmlOutput &xml, VCProject &tool)
{
- if (tool.SingleProjects.count() == 0) {
+ if (tool.SingleProjects.size() == 0) {
warn_msg(WarnLogic, "Generator: .NET: no single project in merge project, no output");
return;
}
@@ -2626,7 +2616,7 @@ void VCProjectWriter::write(XmlOutput &xml, VCProject &tool)
<< closetag(_Platforms)
<< tag(_Configurations);
// Output each configuration
- for (int i = 0; i < tool.SingleProjects.count(); ++i)
+ for (int i = 0; i < tool.SingleProjects.size(); ++i)
write(xml, tool.SingleProjects.at(i).Configuration);
xml << closetag(_Configurations)
<< tag(q_Files);
@@ -2639,7 +2629,7 @@ void VCProjectWriter::write(XmlOutput &xml, VCProject &tool)
outputFilter(tool, xml, "Resource Files");
outputFilter(tool, xml, "Deployment Files");
outputFilter(tool, xml, "Distribution Files");
- for (int x = 0; x < tool.ExtraCompilers.count(); ++x) {
+ for (int x = 0; x < tool.ExtraCompilers.size(); ++x) {
outputFilter(tool, xml, tool.ExtraCompilers.at(x));
}
outputFilter(tool, xml, "Root Files");
@@ -2941,7 +2931,7 @@ void VCProjectWriter::write(XmlOutput &xml, const VCConfiguration &tool)
void VCProjectWriter::write(XmlOutput &xml, VCFilter &tool)
{
- if(!tool.Files.count())
+ if(!tool.Files.size())
return;
if (!tool.Name.isEmpty()) {
@@ -2951,7 +2941,7 @@ void VCProjectWriter::write(XmlOutput &xml, VCFilter &tool)
<< attrS(_UniqueIdentifier, tool.Guid)
<< attrT(_ParseFiles, tool.ParseFiles);
}
- for (int i = 0; i < tool.Files.count(); ++i) {
+ for (int i = 0; i < tool.Files.size(); ++i) {
const VCFilterFile &info = tool.Files.at(i);
xml << tag(q_File)
<< attrS(_RelativePath, Option::fixPathToTargetOS(info.file))
@@ -2975,11 +2965,11 @@ void VCProjectWriter::outputFilter(VCProject &project, XmlOutput &xml, const QSt
QString name, extfilter, guid;
triState parse = unset;
- for (int i = 0; i < project.SingleProjects.count(); ++i) {
+ for (int i = 0; i < project.SingleProjects.size(); ++i) {
const VCFilter filter = project.SingleProjects.at(i).filterByName(filtername);
// Merge all files in this filter to root tree
- for (int x = 0; x < filter.Files.count(); ++x)
+ for (int x = 0; x < filter.Files.size(); ++x)
root->addElement(filter.Files.at(x));
// Save filter setting from first filter. Next filters
@@ -3014,7 +3004,7 @@ void VCProjectWriter::outputFileConfigs(VCProject &project, XmlOutput &xml, cons
{
xml << tag(q_File)
<< attrS(_RelativePath, Option::fixPathToTargetOS(info.file));
- for (int i = 0; i < project.SingleProjects.count(); ++i) {
+ for (int i = 0; i < project.SingleProjects.size(); ++i) {
VCFilter filter = project.SingleProjects.at(i).filterByName(filtername);
if (filter.Config) // only if the filter is not empty
outputFileConfig(filter, xml, info.file);
diff --git a/qmake/generators/win32/msvc_objectmodel.h b/qmake/generators/win32/msvc_objectmodel.h
index c5da1ec3ed..190d6c727f 100644
--- a/qmake/generators/win32/msvc_objectmodel.h
+++ b/qmake/generators/win32/msvc_objectmodel.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** 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) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef MSVC_OBJECTMODEL_H
#define MSVC_OBJECTMODEL_H
@@ -283,7 +258,9 @@ enum inlineExpansionOption {
};
enum linkerDebugOption {
linkerDebugOptionNone,
- linkerDebugOptionFastLink
+ linkerDebugOptionEnabled, // represents /DEBUG without further options
+ linkerDebugOptionFastLink,
+ linkerDebugOptionFull
};
enum linkIncrementalType {
linkIncrementalDefault,
@@ -356,6 +333,7 @@ enum optWin98Type {
enum optLinkTimeCodeGenType {
optLTCGDefault,
optLTCGEnabled,
+ optLTCGIncremental,
optLTCGInstrument,
optLTCGOptimize,
optLTCGUpdate
diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp
index 08e9b759df..2192535867 100644
--- a/qmake/generators/win32/msvc_vcproj.cpp
+++ b/qmake/generators/win32/msvc_vcproj.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** 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) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "msvc_vcproj.h"
#include "option.h"
@@ -33,7 +8,7 @@
#include <ioutils.h>
#include <qdir.h>
-#include <qdiriterator.h>
+#include <qdirlisting.h>
#include <qcryptographichash.h>
#include <qhash.h>
#include <quuid.h>
@@ -46,6 +21,7 @@
//#define DEBUG_SOLUTION_GEN
using namespace QMakeInternal;
+using namespace Qt::StringLiterals;
QT_BEGIN_NAMESPACE
// Filter GUIDs (Do NOT change these!) ------------------------------
@@ -166,24 +142,24 @@ bool VcprojGenerator::writeProjectMakefile()
// Generate project file
if(project->first("TEMPLATE") == "vcapp" ||
project->first("TEMPLATE") == "vclib") {
- if (!mergedProjects.count()) {
+ if (!mergedProjects.size()) {
warn_msg(WarnLogic, "Generator: MSVC.NET: no single configuration created, cannot output project!");
return false;
}
debug_msg(1, "Generator: MSVC.NET: Writing project file");
VCProject mergedProject;
- for (int i = 0; i < mergedProjects.count(); ++i) {
+ for (int i = 0; i < mergedProjects.size(); ++i) {
VCProjectSingleConfig *singleProject = &(mergedProjects.at(i)->vcProject);
mergedProject.SingleProjects += *singleProject;
- for (int j = 0; j < singleProject->ExtraCompilersFiles.count(); ++j) {
+ for (int j = 0; j < singleProject->ExtraCompilersFiles.size(); ++j) {
const QString &compilerName = singleProject->ExtraCompilersFiles.at(j).Name;
if (!mergedProject.ExtraCompilers.contains(compilerName))
mergedProject.ExtraCompilers += compilerName;
}
}
- if(mergedProjects.count() > 1 &&
+ if(mergedProjects.size() > 1 &&
mergedProjects.at(0)->vcProject.Name ==
mergedProjects.at(1)->vcProject.Name)
mergedProjects.at(0)->writePrlFile();
@@ -301,7 +277,7 @@ QString VcprojGenerator::retrievePlatformToolSet() const
if (!envVar.isEmpty())
return envVar;
- return u"v"_qs + project->first("MSVC_TOOLSET_VER");
+ return u"v"_s + project->first("MSVC_TOOLSET_VER");
}
bool VcprojGenerator::isStandardSuffix(const QString &suffix) const
@@ -373,7 +349,7 @@ ProStringList VcprojGenerator::collectDependencies(QMakeProject *proj, QHash<QSt
collectedSubdirs.append(qMakePair(tmpdir.toQString(), proj->values(ProKey(tmp_proj_subdirs.at(x) + ".depends"))));
projLookup.insert(tmp_proj_subdirs.at(x).toQString(), tmpdir.toQString());
}
- for (const auto &subdir : qAsConst(collectedSubdirs)) {
+ for (const auto &subdir : std::as_const(collectedSubdirs)) {
QString profile = subdir.first;
QFileInfo fi(fileInfo(Option::normalizePath(profile)));
if (fi.exists()) {
@@ -442,7 +418,7 @@ ProStringList VcprojGenerator::collectDependencies(QMakeProject *proj, QHash<QSt
newDep->uuid = tmp_proj.isEmpty("QMAKE_UUID") ? getProjectUUID(Option::fixPathToLocalOS(vcprojDir + QDir::separator() + vcproj)).toString().toUpper(): tmp_proj.first("QMAKE_UUID").toQString();
// We want to store it as the .lib name.
if (newDep->target.endsWith(".dll"))
- newDep->target = newDep->target.left(newDep->target.length()-3) + "lib";
+ newDep->target = newDep->target.left(newDep->target.size()-3) + "lib";
projGuids.insert(newDep->projectName, newDep->target);
if (tmpList.size()) {
@@ -658,10 +634,10 @@ void VcprojGenerator::writeSubDirs(QTextStream &t)
bool VcprojGenerator::hasBuiltinCompiler(const QString &file)
{
// Source files
- for (int i = 0; i < Option::cpp_ext.count(); ++i)
+ for (int i = 0; i < Option::cpp_ext.size(); ++i)
if (file.endsWith(Option::cpp_ext.at(i)))
return true;
- for (int i = 0; i < Option::c_ext.count(); ++i)
+ for (int i = 0; i < Option::c_ext.size(); ++i)
if (file.endsWith(Option::c_ext.at(i)))
return true;
if (file.endsWith(".rc")
@@ -791,8 +767,8 @@ void VcprojGenerator::init()
if (autogenPrecompSource) {
precompSource = precompH
+ (pchIsCFile
- ? (Option::c_ext.count() ? Option::c_ext.at(0) : QLatin1String(".c"))
- : (Option::cpp_ext.count() ? Option::cpp_ext.at(0) : QLatin1String(".cpp")));
+ ? (Option::c_ext.size() ? Option::c_ext.at(0) : QLatin1String(".c"))
+ : (Option::cpp_ext.size() ? Option::cpp_ext.at(0) : QLatin1String(".cpp")));
project->values("GENERATED_SOURCES") += precompSource;
} else if (!precompSource.isEmpty()) {
project->values("SOURCES") += precompSource;
@@ -1237,7 +1213,7 @@ void VcprojGenerator::initDeploymentTool()
continue;
// We want to deploy .dlls not .libs
if (dllName.endsWith(QLatin1String(".lib")))
- dllName.replace(dllName.length() - 3, 3, QLatin1String("dll"));
+ dllName.replace(dllName.size() - 3, 3, QLatin1String("dll"));
// Use only the file name and check in Qt's install path and LIBPATHs to check for existence
dllName.remove(0, dllName.lastIndexOf(QLatin1Char('/')) + 1);
QFileInfo info;
@@ -1317,18 +1293,16 @@ void VcprojGenerator::initDeploymentTool()
}
int pathSize = searchPath.size();
- QDirIterator iterator(searchPath, QStringList() << nameFilter
- , QDir::Files | QDir::NoDotAndDotDot | QDir::NoSymLinks
- , QDirIterator::Subdirectories);
+ constexpr auto filters = QDir::Files | QDir::NoDotAndDotDot | QDir::NoSymLinks;
+ using F = QDirListing::IteratorFlag;
+ QDirListing dirList(searchPath, QStringList{nameFilter}, filters, F::Recursive);
// foreach dirIterator-entry in d
- while(iterator.hasNext()) {
- iterator.next();
-
- QString absoluteItemPath = Option::fixPathToTargetOS(QFileInfo(iterator.filePath()).absolutePath());
+ for (const auto &dirEntry : dirList) {
+ const QString absoluteItemPath = Option::fixPathToTargetOS(dirEntry.absolutePath());
// Identify if it is just another subdir
int diffSize = absoluteItemPath.size() - pathSize;
// write out rules
- conf.deployment.AdditionalFiles += iterator.fileName()
+ conf.deployment.AdditionalFiles += dirEntry.fileName()
+ "|" + absoluteItemPath
+ "|" + itemDevicePath + (diffSize ? (absoluteItemPath.right(diffSize)) : QLatin1String(""))
+ "|0;";
@@ -1577,7 +1551,7 @@ void VcprojGenerator::initExtraCompilerOutputs()
} else if (!inputVars.isEmpty()) {
// One output file per input
const ProStringList &tmp_in = project->values(inputVars.first().toKey());
- for (int i = 0; i < tmp_in.count(); ++i) {
+ for (int i = 0; i < tmp_in.size(); ++i) {
const QString &filename = tmp_in.at(i).toQString();
if (extraCompilerSources.contains(filename) && !otherFiltersContain(filename))
extraCompile.addFile(Option::fixPathToTargetOS(
@@ -1592,7 +1566,7 @@ void VcprojGenerator::initExtraCompilerOutputs()
for (const ProString &inputVar : inputVars) {
if (!otherFilters.contains(inputVar)) {
const ProStringList &tmp_in = project->values(inputVar.toKey());
- for (int i = 0; i < tmp_in.count(); ++i) {
+ for (int i = 0; i < tmp_in.size(); ++i) {
const QString &filename = tmp_in.at(i).toQString();
if (extraCompilerSources.contains(filename) && !otherFiltersContain(filename))
extraCompile.addFile(Option::fixPathToTargetOS(
diff --git a/qmake/generators/win32/msvc_vcproj.h b/qmake/generators/win32/msvc_vcproj.h
index c565b709d2..aa4cc53c70 100644
--- a/qmake/generators/win32/msvc_vcproj.h
+++ b/qmake/generators/win32/msvc_vcproj.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** 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) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef MSVC_VCPROJ_H
#define MSVC_VCPROJ_H
diff --git a/qmake/generators/win32/msvc_vcxproj.cpp b/qmake/generators/win32/msvc_vcxproj.cpp
index ccbbf8cbac..1b5541bb16 100644
--- a/qmake/generators/win32/msvc_vcxproj.cpp
+++ b/qmake/generators/win32/msvc_vcxproj.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** 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) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "msvc_vcxproj.h"
#include "msbuild_objectmodel.h"
diff --git a/qmake/generators/win32/msvc_vcxproj.h b/qmake/generators/win32/msvc_vcxproj.h
index 7e02b6c32f..05e5a4c9da 100644
--- a/qmake/generators/win32/msvc_vcxproj.h
+++ b/qmake/generators/win32/msvc_vcxproj.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** 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) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef MSVC_VCXPROJ_H
#define MSVC_VCXPROJ_H
diff --git a/qmake/generators/win32/winmakefile.cpp b/qmake/generators/win32/winmakefile.cpp
index 422919b872..c8317389f5 100644
--- a/qmake/generators/win32/winmakefile.cpp
+++ b/qmake/generators/win32/winmakefile.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** 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) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "winmakefile.h"
#include "option.h"
@@ -199,9 +174,9 @@ bool Win32MakefileGenerator::processPrlFileBase(QString &origFile, QStringView o
{
if (MakefileGenerator::processPrlFileBase(origFile, origName, fixedBase, slashOff))
return true;
- for (int off = fixedBase.length(); off > slashOff; off--) {
+ for (int off = fixedBase.size(); off > slashOff; off--) {
if (!fixedBase.at(off - 1).isDigit()) {
- if (off != fixedBase.length()) {
+ if (off != fixedBase.size()) {
return MakefileGenerator::processPrlFileBase(
origFile, origName, fixedBase.left(off), slashOff);
}
@@ -504,8 +479,8 @@ void Win32MakefileGenerator::writeCleanParts(QTextStream &t)
const int commandlineLimit = 2047; // NT limit, expanded
for (ProStringList::ConstIterator it = list.begin(); it != list.end(); ++it) {
file = ' ' + escapeFilePath(Option::fixPathToTargetOS((*it).toQString()));
- if(del_statement.length() + files.length() +
- qMax(fixEnvVariables(file).length(), file.length()) > commandlineLimit) {
+ if(del_statement.size() + files.size() +
+ qMax(fixEnvVariables(file).size(), file.size()) > commandlineLimit) {
t << "\n\t" << del_statement << files;
files.clear();
}
@@ -533,8 +508,8 @@ void Win32MakefileGenerator::writeCleanParts(QTextStream &t)
const int commandlineLimit = 2047; // NT limit, expanded
for (ProStringList::ConstIterator it = list.begin(); it != list.end(); ++it) {
file = " " + escapeFilePath(Option::fixPathToTargetOS((*it).toQString()));
- if(del_statement.length() + files.length() +
- qMax(fixEnvVariables(file).length(), file.length()) > commandlineLimit) {
+ if(del_statement.size() + files.size() +
+ qMax(fixEnvVariables(file).size(), file.size()) > commandlineLimit) {
t << "\n\t" << del_statement << files;
files.clear();
}
@@ -711,7 +686,7 @@ void Win32MakefileGenerator::writeRcFilePart(QTextStream &t)
const ProStringList rcIncPaths = project->values("RC_INCLUDEPATH");
QString incPathStr;
- for (int i = 0; i < rcIncPaths.count(); ++i) {
+ for (int i = 0; i < rcIncPaths.size(); ++i) {
const ProString &path = rcIncPaths.at(i);
if (path.isEmpty())
continue;
@@ -774,7 +749,7 @@ QString Win32MakefileGenerator::defaultInstall(const QString &t)
QString dst_prl = Option::fixPathToTargetOS(project->first("QMAKE_INTERNAL_PRL_FILE").toQString());
int slsh = dst_prl.lastIndexOf(Option::dir_sep);
if(slsh != -1)
- dst_prl = dst_prl.right(dst_prl.length() - slsh - 1);
+ dst_prl = dst_prl.right(dst_prl.size() - slsh - 1);
dst_prl = filePrefixRoot(root, targetdir + dst_prl);
if (!ret.isEmpty())
ret += "\n\t";
diff --git a/qmake/generators/win32/winmakefile.h b/qmake/generators/win32/winmakefile.h
index 180bd0fde8..bdab01b488 100644
--- a/qmake/generators/win32/winmakefile.h
+++ b/qmake/generators/win32/winmakefile.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** 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) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef WINMAKEFILE_H
#define WINMAKEFILE_H
diff --git a/qmake/generators/xmloutput.cpp b/qmake/generators/xmloutput.cpp
index c43f8d810b..be64176f33 100644
--- a/qmake/generators/xmloutput.cpp
+++ b/qmake/generators/xmloutput.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** 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) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "xmloutput.h"
@@ -103,7 +78,7 @@ void XmlOutput::decreaseIndent()
QString XmlOutput::doConversion(const QString &text)
{
- if (!text.count())
+ if (!text.size())
return QString();
else if (conversion == NoConversion)
return text;
@@ -112,10 +87,10 @@ QString XmlOutput::doConversion(const QString &text)
if (conversion == XMLConversion) {
// this is a way to escape characters that shouldn't be converted
- for (int i=0; i<text.count(); ++i) {
+ for (int i=0; i<text.size(); ++i) {
const QChar c = text.at(i);
if (c == QLatin1Char('&')) {
- if ( (i + 7) < text.count() &&
+ if ( (i + 7) < text.size() &&
text.at(i + 1) == QLatin1Char('#') &&
text.at(i + 2) == QLatin1Char('x') &&
text.at(i + 7) == QLatin1Char(';') ) {
@@ -184,9 +159,9 @@ XmlOutput& XmlOutput::operator<<(const xml_output& o)
addRaw(QString("\n%1<Import %2=\"%3\" />").arg(currentIndent).arg(o.xo_text).arg(o.xo_value));
break;
case tCloseTag:
- if (o.xo_value.count())
+ if (o.xo_value.size())
closeAll();
- else if (o.xo_text.count())
+ else if (o.xo_text.size())
closeTo(o.xo_text);
else
closeTag();
@@ -201,7 +176,7 @@ XmlOutput& XmlOutput::operator<<(const xml_output& o)
{
// Special case to be able to close tag in normal
// way ("</tag>", not "/>") without using addRaw()..
- if (!o.xo_text.count()) {
+ if (!o.xo_text.size()) {
closeOpen();
break;
}
@@ -230,14 +205,14 @@ XmlOutput& XmlOutput::operator<<(const xml_output& o)
// Output functions ----------------------------------------------------------
void XmlOutput::newTag(const QString &tag)
{
- Q_ASSERT_X(tag.count(), "XmlOutput", "Cannot open an empty tag");
+ Q_ASSERT_X(tag.size(), "XmlOutput", "Cannot open an empty tag");
newTagOpen(tag);
closeOpen();
}
void XmlOutput::newTagOpen(const QString &tag)
{
- Q_ASSERT_X(tag.count(), "XmlOutput", "Cannot open an empty tag");
+ Q_ASSERT_X(tag.size(), "XmlOutput", "Cannot open an empty tag");
closeOpen();
if (format == NewLine)
@@ -265,9 +240,9 @@ void XmlOutput::closeTag()
{
switch(currentState) {
case Bare:
- if (tagStack.count())
+ if (tagStack.size())
//warn_msg(WarnLogic, "<Root>: Cannot close tag in Bare state, %d tags on stack", tagStack.count());
- qDebug("<Root>: Cannot close tag in Bare state, %d tags on stack", int(tagStack.count()));
+ qDebug("<Root>: Cannot close tag in Bare state, %d tags on stack", int(tagStack.size()));
else
//warn_msg(WarnLogic, "<Root>: Cannot close tag, no tags on stack");
qDebug("<Root>: Cannot close tag, no tags on stack");
@@ -296,7 +271,7 @@ void XmlOutput::closeTo(const QString &tag)
qDebug("<%s>: Cannot close to tag <%s>, not on stack", tagStack.last().toLatin1().constData(), tag.toLatin1().constData());
return;
}
- int left = tagStack.count();
+ int left = tagStack.size();
while (left-- && cont) {
cont = tagStack.last().compare(tag) != 0;
closeTag();
@@ -305,7 +280,7 @@ void XmlOutput::closeTo(const QString &tag)
void XmlOutput::closeAll()
{
- if (!tagStack.count())
+ if (!tagStack.size())
return;
closeTo(QString());
}
@@ -340,7 +315,7 @@ void XmlOutput::addAttribute(const QString &attribute, const QString &value)
case Tag:
//warn_msg(WarnLogic, "<%s>: Cannot add attribute since tags not open", tagStack.last().toLatin1().constData());
qDebug("<%s>: Cannot add attribute (%s) since tag's not open",
- (tagStack.count() ? tagStack.last().toLatin1().constData() : "Root"),
+ (tagStack.size() ? tagStack.last().toLatin1().constData() : "Root"),
attribute.toLatin1().constData());
return;
case Attribute:
@@ -358,7 +333,7 @@ void XmlOutput::addAttributeTag(const QString &attribute, const QString &value)
case Tag:
//warn_msg(WarnLogic, "<%s>: Cannot add attribute since tags not open", tagStack.last().toLatin1().constData());
qDebug("<%s>: Cannot add attribute (%s) since tag's not open",
- (tagStack.count() ? tagStack.last().toLatin1().constData() : "Root"),
+ (tagStack.size() ? tagStack.last().toLatin1().constData() : "Root"),
attribute.toLatin1().constData());
return;
case Attribute:
diff --git a/qmake/generators/xmloutput.h b/qmake/generators/xmloutput.h
index d16634ee3b..44f80ac7e4 100644
--- a/qmake/generators/xmloutput.h
+++ b/qmake/generators/xmloutput.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** 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) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef XMLOUTPUT_H
#define XMLOUTPUT_H
diff --git a/qmake/library/ioutils.cpp b/qmake/library/ioutils.cpp
index c46eb7b663..38bb246341 100644
--- a/qmake/library/ioutils.cpp
+++ b/qmake/library/ioutils.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** 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) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "ioutils.h"
@@ -34,6 +9,7 @@
#ifdef Q_OS_WIN
# include <qt_windows.h>
+# include <private/qsystemerror_p.h>
#else
# include <sys/types.h>
# include <sys/stat.h>
@@ -161,7 +137,7 @@ bool isSpecialChar(ushort c, const uchar (&iqm)[16])
inline static
bool hasSpecialChars(const QString &arg, const uchar (&iqm)[16])
{
- for (int x = arg.length() - 1; x >= 0; --x) {
+ for (int x = arg.size() - 1; x >= 0; --x) {
if (isSpecialChar(arg.unicode()[x].unicode(), iqm))
return true;
}
@@ -176,7 +152,7 @@ QString IoUtils::shellQuoteUnix(const QString &arg)
0x00, 0x00, 0x00, 0x38, 0x01, 0x00, 0x00, 0x78
}; // 0-32 \'"$`<>|;&(){}*?#!~[]
- if (!arg.length())
+ if (!arg.size())
return QString::fromLatin1("''");
QString ret(arg);
@@ -204,7 +180,7 @@ QString IoUtils::shellQuoteWin(const QString &arg)
0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x10
}; // &()<>^|
- if (!arg.length())
+ if (!arg.size())
return QString::fromLatin1("\"\"");
QString ret(arg);
@@ -220,7 +196,7 @@ QString IoUtils::shellQuoteWin(const QString &arg)
// to the called process verbatim. In the unquoted state, the circumflex escapes
// meta chars (including itself and quotes), and is removed from the command.
bool quoted = true;
- for (int i = 0; i < ret.length(); i++) {
+ for (int i = 0; i < ret.size(); i++) {
QChar c = ret.unicode()[i];
if (c.unicode() == '"')
quoted = !quoted;
@@ -237,23 +213,6 @@ QString IoUtils::shellQuoteWin(const QString &arg)
#if defined(PROEVALUATOR_FULL)
-# if defined(Q_OS_WIN)
-static QString windowsErrorCode()
-{
- wchar_t *string = nullptr;
- FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM,
- NULL,
- GetLastError(),
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
- (LPWSTR)&string,
- 0,
- NULL);
- QString ret = QString::fromWCharArray(string);
- LocalFree((HLOCAL)string);
- return ret.trimmed();
-}
-# endif
-
bool IoUtils::touchFile(const QString &targetFileName, const QString &referenceFileName, QString *errorString)
{
# ifdef Q_OS_UNIX
@@ -280,7 +239,8 @@ bool IoUtils::touchFile(const QString &targetFileName, const QString &referenceF
GENERIC_READ, FILE_SHARE_READ,
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (rHand == INVALID_HANDLE_VALUE) {
- *errorString = fL1S("Cannot open reference file %1: %2").arg(referenceFileName, windowsErrorCode());
+ *errorString = fL1S("Cannot open reference file %1: %2")
+ .arg(referenceFileName, QSystemError::windowsString());
return false;
}
FILETIME ft;
@@ -290,7 +250,8 @@ bool IoUtils::touchFile(const QString &targetFileName, const QString &referenceF
GENERIC_WRITE, FILE_SHARE_READ,
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (wHand == INVALID_HANDLE_VALUE) {
- *errorString = fL1S("Cannot open %1: %2").arg(targetFileName, windowsErrorCode());
+ *errorString = fL1S("Cannot open %1: %2")
+ .arg(targetFileName, QSystemError::windowsString());
return false;
}
SetFileTime(wHand, NULL, NULL, &ft);
diff --git a/qmake/library/ioutils.h b/qmake/library/ioutils.h
index c2b85dba04..2f288e543e 100644
--- a/qmake/library/ioutils.h
+++ b/qmake/library/ioutils.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** 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) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef IOUTILS_H
#define IOUTILS_H
diff --git a/qmake/library/proitems.cpp b/qmake/library/proitems.cpp
index a8f4dfe039..2edd40a35c 100644
--- a/qmake/library/proitems.cpp
+++ b/qmake/library/proitems.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** 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) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "proitems.h"
@@ -65,13 +40,13 @@ ProString::ProString(const ProString &other, OmitPreHashing) :
}
ProString::ProString(const QString &str, DoPreHashing) :
- m_string(str), m_offset(0), m_length(str.length()), m_file(0)
+ m_string(str), m_offset(0), m_length(str.size()), m_file(0)
{
updatedHash();
}
ProString::ProString(const QString &str) :
- m_string(str), m_offset(0), m_length(str.length()), m_file(0), m_hash(0x80000000)
+ m_string(str), m_offset(0), m_length(str.size()), m_file(0), m_hash(0x80000000)
{
}
@@ -109,7 +84,7 @@ ProString::ProString(const QString &str, int offset, int length) :
void ProString::setValue(const QString &str)
{
- m_string = str, m_offset = 0, m_length = str.length(), m_hash = 0x80000000;
+ m_string = str, m_offset = 0, m_length = str.size(), m_hash = 0x80000000;
}
size_t ProString::updatedHash() const
@@ -146,7 +121,7 @@ ProKey::ProKey(const QString &str, int off, int len, uint hash) :
void ProKey::setValue(const QString &str)
{
- m_string = str, m_offset = 0, m_length = str.length();
+ m_string = str, m_offset = 0, m_length = str.size();
updatedHash();
}
@@ -169,7 +144,7 @@ ProString &ProString::prepend(const ProString &other)
} else {
m_string = other.toQStringView() + toQStringView();
m_offset = 0;
- m_length = m_string.length();
+ m_length = m_string.size();
if (!m_file)
m_file = other.m_file;
m_hash = 0x80000000;
@@ -181,10 +156,10 @@ ProString &ProString::prepend(const ProString &other)
ProString &ProString::append(const QLatin1String other)
{
if (other.size()) {
- if (m_length != m_string.length()) {
+ if (m_length != m_string.size()) {
m_string = toQStringView() + other;
m_offset = 0;
- m_length = m_string.length();
+ m_length = m_string.size();
} else {
Q_ASSERT(m_offset == 0);
m_string.append(other);
@@ -197,10 +172,10 @@ ProString &ProString::append(const QLatin1String other)
ProString &ProString::append(QChar other)
{
- if (m_length != m_string.length()) {
+ if (m_length != m_string.size()) {
m_string = toQStringView() + other;
m_offset = 0;
- m_length = m_string.length();
+ m_length = m_string.size();
} else {
Q_ASSERT(m_offset == 0);
m_string.append(other);
@@ -217,14 +192,14 @@ ProString &ProString::append(const ProString &other, bool *pending)
if (!m_length) {
*this = other;
} else {
- if (m_length != m_string.length())
+ if (m_length != m_string.size())
m_string = toQString();
if (pending && !*pending) {
m_string += QLatin1Char(' ') + other.toQStringView();
} else {
m_string += other.toQStringView();
}
- m_length = m_string.length();
+ m_length = m_string.size();
m_offset = 0;
if (other.m_file)
m_file = other.m_file;
@@ -248,14 +223,9 @@ ProString &ProString::append(const ProStringList &other, bool *pending, bool ski
if (!m_length && sz == startIdx + 1) {
*this = other.at(startIdx);
} else {
- int totalLength = sz - startIdx;
- for (int i = startIdx; i < sz; ++i)
- totalLength += other.at(i).size();
bool putSpace = false;
if (pending && !*pending && m_length)
putSpace = true;
- else
- totalLength--;
m_string = toQString();
m_offset = 0;
@@ -267,7 +237,7 @@ ProString &ProString::append(const ProStringList &other, bool *pending, bool ski
const ProString &str = other.at(i);
m_string += str.toQStringView();
}
- m_length = m_string.length();
+ m_length = m_string.size();
if (other.last().m_file)
m_file = other.last().m_file;
m_hash = 0x80000000;
diff --git a/qmake/library/proitems.h b/qmake/library/proitems.h
index f7eef39988..2de982034c 100644
--- a/qmake/library/proitems.h
+++ b/qmake/library/proitems.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** 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) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef PROITEMS_H
#define PROITEMS_H
diff --git a/qmake/library/qmake_global.h b/qmake/library/qmake_global.h
index a718763859..612de43e9b 100644
--- a/qmake/library/qmake_global.h
+++ b/qmake/library/qmake_global.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** 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) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef QMAKE_GLOBAL_H
#define QMAKE_GLOBAL_H
diff --git a/qmake/library/qmakebuiltins.cpp b/qmake/library/qmakebuiltins.cpp
index 5469a2ca7c..f885bb19c3 100644
--- a/qmake/library/qmakebuiltins.cpp
+++ b/qmake/library/qmakebuiltins.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 The Qt Company Ltd.
-** 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) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "qmakeevaluator.h"
@@ -250,12 +225,12 @@ QMakeEvaluator::getMemberArgs(const ProKey &func, int srclen, const ProStringLis
int *start, int *end)
{
*start = 0, *end = 0;
- if (args.count() >= 2) {
+ if (args.size() >= 2) {
bool ok = true;
const ProString &start_str = args.at(1);
*start = start_str.toInt(&ok);
if (!ok) {
- if (args.count() == 2) {
+ if (args.size() == 2) {
int dotdot = start_str.indexOf(statics.strDotDot);
if (dotdot != -1) {
*start = start_str.left(dotdot).toInt(&ok);
@@ -271,7 +246,7 @@ QMakeEvaluator::getMemberArgs(const ProKey &func, int srclen, const ProStringLis
}
} else {
*end = *start;
- if (args.count() == 3)
+ if (args.size() == 3)
*end = args.at(2).toInt(&ok);
if (!ok) {
ProStringRoUser u1(func, m_tmp1);
@@ -571,7 +546,7 @@ void QMakeEvaluator::populateDeps(
if (depends.isEmpty()) {
rootSet.insert(first(ProKey(prefix + item + priosfx)).toInt(), item);
} else {
- for (const ProString &dep : qAsConst(depends)) {
+ for (const ProString &dep : std::as_const(depends)) {
dset.insert(dep.toKey());
dependees[dep.toKey()] << item;
}
@@ -620,7 +595,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand(
var = args[0];
sep = args.at(1).toQString();
beg = args.at(2).toInt();
- if (args.count() == 4)
+ if (args.size() == 4)
end = args.at(3).toInt();
} else {
var = args[0];
@@ -655,7 +630,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand(
case E_SPRINTF: {
ProStringRwUser u1(args.at(0), m_tmp1);
QString tmp = u1.str();
- for (int i = 1; i < args.count(); ++i)
+ for (int i = 1; i < args.size(); ++i)
tmp = tmp.arg(args.at(i).toQStringView());
ret << u1.extract(tmp);
break;
@@ -667,7 +642,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand(
bool zeropad = false;
bool leftalign = false;
enum { DefaultSign, PadSign, AlwaysSign } sign = DefaultSign;
- if (args.count() >= 2) {
+ if (args.size() >= 2) {
const auto opts = split_value_list(args.at(1).toQStringView());
for (const ProString &opt : opts) {
if (opt.startsWith(QLatin1String("ibase="))) {
@@ -712,7 +687,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand(
outstr = QLatin1Char(' ');
}
QString numstr = QString::number(num, obase);
- int space = width - outstr.length() - numstr.length();
+ int space = width - outstr.size() - numstr.size();
if (space <= 0) {
outstr += numstr;
} else if (leftalign) {
@@ -728,7 +703,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand(
}
case E_NUM_ADD: {
qlonglong sum = 0;
- for (const ProString &arg : qAsConst(args)) {
+ for (const ProString &arg : std::as_const(args)) {
if (arg.contains(QLatin1Char('.'))) {
evalError(fL1S("num_add(): floats are currently not supported."));
goto allfail;
@@ -747,11 +722,11 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand(
}
case E_JOIN: {
ProString glue, before, after;
- if (args.count() >= 2)
+ if (args.size() >= 2)
glue = args.at(1);
- if (args.count() >= 3)
+ if (args.size() >= 3)
before = args[2];
- if (args.count() == 4)
+ if (args.size() == 4)
after = args[3];
const ProStringList &var = values(map(args.at(0)));
if (!var.isEmpty()) {
@@ -767,7 +742,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand(
}
case E_SPLIT: {
ProStringRoUser u1(m_tmp1);
- const QString &sep = (args.count() == 2) ? u1.set(args.at(1)) : statics.field_sep;
+ const QString &sep = (args.size() == 2) ? u1.set(args.at(1)) : statics.field_sep;
const auto vars = values(map(args.at(0)));
for (const ProString &var : vars) {
// FIXME: this is inconsistent with the "there are no empty strings" dogma.
@@ -841,7 +816,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand(
bool blob = false;
bool lines = false;
bool singleLine = true;
- if (args.count() > 1) {
+ if (args.size() > 1) {
if (!args.at(1).compare(QLatin1String("false"), Qt::CaseInsensitive))
singleLine = false;
else if (!args.at(1).compare(QLatin1String("blob"), Qt::CaseInsensitive))
@@ -908,7 +883,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand(
bool blob = false;
bool lines = false;
bool singleLine = true;
- if (args.count() > 1) {
+ if (args.size() > 1) {
if (!args.at(1).compare(QLatin1String("false"), Qt::CaseInsensitive))
singleLine = false;
else if (!args.at(1).compare(QLatin1String("blob"), Qt::CaseInsensitive))
@@ -918,7 +893,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand(
}
int exitCode;
QByteArray bytes = getCommandOutput(args.at(0).toQString(), &exitCode);
- if (args.count() > 2 && !args.at(2).isEmpty()) {
+ if (args.size() > 2 && !args.at(2).isEmpty()) {
m_valuemapStack.top()[args.at(2).toKey()] =
ProStringList(ProString(QString::number(exitCode)));
}
@@ -961,7 +936,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand(
for (int i = 0; i < args.size(); ++i) {
QString str = args.at(i).toQString();
QChar *i_data = str.data();
- int i_len = str.length();
+ int i_len = str.size();
for (int x = 0; x < i_len; ++x) {
if (*(i_data+x) == QLatin1Char('\\') && x < i_len-1) {
if (*(i_data+x+1) == QLatin1Char('\\')) {
@@ -1006,14 +981,14 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand(
case E_UPPER:
case E_LOWER:
case E_TITLE:
- for (int i = 0; i < args.count(); ++i) {
+ for (int i = 0; i < args.size(); ++i) {
ProStringRwUser u1(args.at(i), m_tmp1);
QString rstr = u1.str();
if (func_t == E_UPPER) {
rstr = rstr.toUpper();
} else {
rstr = rstr.toLower();
- if (func_t == E_TITLE && rstr.length() > 0)
+ if (func_t == E_TITLE && rstr.size() > 0)
rstr[0] = rstr.at(0).toTitleCase();
}
ret << u1.extract(rstr);
@@ -1021,7 +996,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand(
break;
case E_FILES: {
bool recursive = false;
- if (args.count() == 2)
+ if (args.size() == 2)
recursive = isTrue(args.at(1));
QStringList dirs;
ProStringRoUser u1(args.at(0), m_tmp1);
@@ -1047,7 +1022,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand(
evalError(fL1S("section(): Encountered invalid wildcard expression '%1'.").arg(pattern));
goto allfail;
}
- for (int d = 0; d < dirs.count(); d++) {
+ for (int d = 0; d < dirs.size(); d++) {
QString dir = dirs[d];
QDir qdir(pfx + dir);
for (int i = 0, count = int(qdir.count()); i < count; ++i) {
@@ -1069,7 +1044,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand(
ProStringRoUser u1(args.at(0), m_tmp1);
QString msg = m_option->expandEnvVars(u1.str());
bool decorate = true;
- if (args.count() == 2)
+ if (args.size() == 2)
decorate = isTrue(args.at(1));
if (decorate) {
if (!msg.endsWith(QLatin1Char('?')))
@@ -1116,10 +1091,10 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand(
ProValueMap dependees;
QMultiMap<int, ProString> rootSet;
ProStringList orgList = values(args.at(0).toKey());
- ProString prefix = args.count() < 2 ? ProString() : args.at(1);
- ProString priosfx = args.count() < 4 ? ProString(".priority") : args.at(3);
+ ProString prefix = args.size() < 2 ? ProString() : args.at(1);
+ ProString priosfx = args.size() < 4 ? ProString(".priority") : args.at(3);
populateDeps(orgList, prefix,
- args.count() < 3 ? ProStringList(ProString(".depends"))
+ args.size() < 3 ? ProStringList(ProString(".depends"))
: split_value_list(args.at(2).toQStringView()),
priosfx, dependencies, dependees, rootSet);
while (!rootSet.isEmpty()) {
@@ -1128,7 +1103,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand(
rootSet.erase(it);
if ((func_t == E_RESOLVE_DEPENDS) || orgList.contains(item))
ret.prepend(item);
- for (const ProString &dep : qAsConst(dependees[item.toKey()])) {
+ for (const ProString &dep : std::as_const(dependees[item.toKey()])) {
QSet<ProKey> &dset = dependencies[dep.toKey()];
dset.remove(item.toKey());
if (dset.isEmpty())
@@ -1139,11 +1114,11 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand(
}
case E_ENUMERATE_VARS: {
QSet<ProString> keys;
- for (const ProValueMap &vmap : qAsConst(m_valuemapStack))
+ for (const ProValueMap &vmap : std::as_const(m_valuemapStack))
for (ProValueMap::ConstIterator it = vmap.constBegin(); it != vmap.constEnd(); ++it)
keys.insert(it.key());
ret.reserve(keys.size());
- for (const ProString &key : qAsConst(keys))
+ for (const ProString &key : std::as_const(keys))
ret << key;
break; }
case E_SHADOWED: {
@@ -1156,7 +1131,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand(
case E_ABSOLUTE_PATH: {
ProStringRwUser u1(args.at(0), m_tmp1);
ProStringRwUser u2(m_tmp2);
- QString baseDir = args.count() > 1
+ QString baseDir = args.size() > 1
? IoUtils::resolvePath(currentDirectory(), u2.set(args.at(1)))
: currentDirectory();
QString rstr = u1.str().isEmpty() ? baseDir : IoUtils::resolvePath(baseDir, u1.str());
@@ -1166,7 +1141,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand(
case E_RELATIVE_PATH: {
ProStringRwUser u1(args.at(0), m_tmp1);
ProStringRoUser u2(m_tmp2);
- QString baseDir = args.count() > 1
+ QString baseDir = args.size() > 1
? IoUtils::resolvePath(currentDirectory(), u2.set(args.at(1)))
: currentDirectory();
QString absArg = u1.str().isEmpty() ? baseDir : IoUtils::resolvePath(baseDir, u1.str());
@@ -1277,7 +1252,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::testFunc_cache(const ProStringList &
enum { TargetStash, TargetCache, TargetSuper } target = TargetCache;
enum { CacheSet, CacheAdd, CacheSub } mode = CacheSet;
ProKey srcvar;
- if (args.count() >= 2) {
+ if (args.size() >= 2) {
const auto opts = split_value_list(args.at(1).toQStringView());
for (const ProString &opt : opts) {
if (opt == QLatin1String("transient")) {
@@ -1297,7 +1272,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::testFunc_cache(const ProStringList &
return ReturnFalse;
}
}
- if (args.count() >= 3) {
+ if (args.size() >= 3) {
srcvar = args.at(2).toKey();
} else if (mode != CacheSet) {
evalError(fL1S("cache(): modes other than 'set' require a source variable."));
@@ -1392,7 +1367,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::testFunc_cache(const ProStringList &
varstr += QLatin1String(" -=");
else
varstr += QLatin1String(" =");
- if (diffval.count() == 1) {
+ if (diffval.size() == 1) {
varstr += QLatin1Char(' ');
varstr += quoteValue(diffval.at(0));
} else if (!diffval.isEmpty()) {
@@ -1450,7 +1425,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
switch (func_t) {
case T_DEFINED: {
const ProKey &var = args.at(0).toKey();
- if (args.count() > 1) {
+ if (args.size() > 1) {
if (args[1] == QLatin1String("test")) {
return returnBool(m_functionDefs.testFunctions.contains(var));
} else if (args[1] == QLatin1String("replace")) {
@@ -1537,7 +1512,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
VisitReturn ok = evaluateFileInto(fn, &vars, LoadProOnly);
if (ok != ReturnTrue)
return ok;
- if (args.count() == 2)
+ if (args.size() == 2)
return returnBool(vars.contains(map(args.at(1))));
QRegularExpression regx;
regx.setPatternOptions(QRegularExpression::DotMatchesEverythingOption);
@@ -1587,14 +1562,14 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
m_current.pro->fileName(), m_current.line);
}
case T_CONFIG: {
- if (args.count() == 1)
+ if (args.size() == 1)
return returnBool(isActiveConfig(args.at(0).toQStringView()));
const auto mutuals = args.at(1).toQStringView().split(QLatin1Char('|'),
Qt::SkipEmptyParts);
const ProStringList &configs = values(statics.strCONFIG);
for (int i = configs.size() - 1; i >= 0; i--) {
- for (int mut = 0; mut < mutuals.count(); mut++) {
+ for (int mut = 0; mut < mutuals.size(); mut++) {
if (configs[i].toQStringView() == mutuals[mut].trimmed())
return returnBool(configs[i] == args[0]);
}
@@ -1614,7 +1589,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
}
}
const ProStringList &l = values(map(args.at(0)));
- if (args.count() == 2) {
+ if (args.size() == 2) {
for (int i = 0; i < l.size(); ++i) {
const ProString &val = l[i];
if (val == qry)
@@ -1630,7 +1605,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
Qt::SkipEmptyParts);
for (int i = l.size() - 1; i >= 0; i--) {
const ProString &val = l[i];
- for (int mut = 0; mut < mutuals.count(); mut++) {
+ for (int mut = 0; mut < mutuals.size(); mut++) {
if (val.toQStringView() == mutuals[mut].trimmed()) {
if (val == qry)
return ReturnTrue;
@@ -1647,9 +1622,9 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
return ReturnFalse;
}
case T_COUNT: {
- int cnt = values(map(args.at(0))).count();
+ int cnt = values(map(args.at(0))).size();
int val = args.at(1).toInt();
- if (args.count() == 3) {
+ if (args.size() == 3) {
const ProString &comp = args.at(2);
if (comp == QLatin1String(">") || comp == QLatin1String("greaterThan")) {
return returnBool(cnt > val);
@@ -1735,10 +1710,10 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
LoadFlags flags;
if (m_cumulative)
flags = LoadSilent;
- if (args.count() >= 2) {
+ if (args.size() >= 2) {
if (!args.at(1).isEmpty())
parseInto = args.at(1) + QLatin1Char('.');
- if (args.count() >= 3 && isTrue(args.at(2)))
+ if (args.size() >= 3 && isTrue(args.at(2)))
flags = LoadSilent;
}
QString fn = filePathEnvArg0(args);
@@ -1770,7 +1745,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
return ok;
}
case T_LOAD: {
- bool ignore_error = (args.count() == 2 && isTrue(args.at(1)));
+ bool ignore_error = (args.size() == 2 && isTrue(args.at(1)));
VisitReturn ok = evaluateFeatureFile(m_option->expandEnvVars(args.at(0).toQString()),
ignore_error);
if (ok == ReturnFalse && ignore_error)
@@ -1869,11 +1844,11 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
QIODevice::OpenMode mode = QIODevice::Truncate;
QMakeVfs::VfsFlags flags = (m_cumulative ? QMakeVfs::VfsCumulative : QMakeVfs::VfsExact);
QString contents;
- if (args.count() >= 2) {
+ if (args.size() >= 2) {
const ProStringList &vals = values(args.at(1).toKey());
if (!vals.isEmpty())
contents = vals.join(QLatin1Char('\n')) + QLatin1Char('\n');
- if (args.count() >= 3) {
+ if (args.size() >= 3) {
const auto opts = split_value_list(args.at(2).toQStringView());
for (const ProString &opt : opts) {
if (opt == QLatin1String("append")) {
diff --git a/qmake/library/qmakeevaluator.cpp b/qmake/library/qmakeevaluator.cpp
index 3b0ff8ee93..df3f92d7d5 100644
--- a/qmake/library/qmakeevaluator.cpp
+++ b/qmake/library/qmakeevaluator.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** 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) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "qmakeevaluator.h"
#include "qmakeevaluator_p.h"
@@ -281,7 +256,7 @@ ProStringList QMakeEvaluator::split_value_list(QStringView vals, int source)
source = currentFileId();
const QChar *vals_data = vals.data();
- const int vals_len = vals.length();
+ const int vals_len = vals.size();
char16_t quote = 0;
bool hadWord = false;
for (int x = 0; x < vals_len; x++) {
@@ -826,7 +801,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProLoop(
} else {
ProString val;
do {
- if (index >= list.count())
+ if (index >= list.size())
goto do_break;
val = list.at(index++);
} while (val.isEmpty()); // stupid, but qmake is like that
@@ -878,19 +853,19 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProVariable(
if (expandVariableReferences(tokPtr, sizeHint, &varVal, true) == ReturnError)
return ReturnError;
QStringView val = varVal.at(0).toQStringView();
- if (val.length() < 4 || val.at(0) != QLatin1Char('s')) {
+ if (val.size() < 4 || val.at(0) != QLatin1Char('s')) {
evalError(fL1S("The ~= operator can handle only the s/// function."));
return ReturnTrue;
}
QChar sep = val.at(1);
auto func = val.split(sep, Qt::KeepEmptyParts);
- if (func.count() < 3 || func.count() > 4) {
+ if (func.size() < 3 || func.size() > 4) {
evalError(fL1S("The s/// function expects 3 or 4 arguments."));
return ReturnTrue;
}
bool global = false, quote = false, case_sense = false;
- if (func.count() == 4) {
+ if (func.size() == 4) {
global = func[3].indexOf(QLatin1Char('g')) != -1;
case_sense = func[3].indexOf(QLatin1Char('i')) == -1;
quote = func[3].indexOf(QLatin1Char('q')) != -1;
@@ -1038,10 +1013,13 @@ static ProString msvcArchitecture(const QString &vcInstallDir, const QString &pa
void QMakeEvaluator::loadDefaults()
{
ProValueMap &vars = m_valuemapStack.top();
+ qlonglong sde = qgetenv("SOURCE_DATE_EPOCH").toLongLong();
+ QDateTime builddate = sde ? QDateTime::fromSecsSinceEpoch(sde)
+ : QDateTime::currentDateTime();
vars[ProKey("DIR_SEPARATOR")] << ProString(m_option->dir_sep);
vars[ProKey("DIRLIST_SEPARATOR")] << ProString(m_option->dirlist_sep);
- vars[ProKey("_DATE_")] << ProString(QDateTime::currentDateTime().toString());
+ vars[ProKey("_DATE_")] << ProString(builddate.toString());
if (!m_option->qmake_abslocation.isEmpty())
vars[ProKey("QMAKE_QMAKE")] << ProString(m_option->qmake_abslocation);
if (!m_option->qmake_args.isEmpty())
@@ -1258,7 +1236,7 @@ bool QMakeEvaluator::loadSpec()
qmakespec = m_hostBuild ? QLatin1String("default-host") : QLatin1String("default");
#endif
if (IoUtils::isRelativePath(qmakespec)) {
- for (const QString &root : qAsConst(m_mkspecPaths)) {
+ for (const QString &root : std::as_const(m_mkspecPaths)) {
QString mkspec = root + QLatin1Char('/') + qmakespec;
if (IoUtils::exists(mkspec)) {
qmakespec = mkspec;
@@ -1500,7 +1478,7 @@ void QMakeEvaluator::updateMkspecPaths()
for (const QString &it : paths)
ret << it + concat;
- for (const QString &it : qAsConst(m_qmakepath))
+ for (const QString &it : std::as_const(m_qmakepath))
ret << it + concat;
if (!m_buildRoot.isEmpty())
@@ -1541,7 +1519,7 @@ void QMakeEvaluator::updateFeaturePaths()
for (const QString &item : items)
feature_bases << (item + mkspecs_concat);
- for (const QString &item : qAsConst(m_qmakepath))
+ for (const QString &item : std::as_const(m_qmakepath))
feature_bases << (item + mkspecs_concat);
if (!m_qmakespec.isEmpty()) {
@@ -1563,21 +1541,21 @@ void QMakeEvaluator::updateFeaturePaths()
feature_bases << (m_option->propertyValue(ProKey("QT_HOST_DATA/get")) + mkspecs_concat);
feature_bases << (m_option->propertyValue(ProKey("QT_HOST_DATA/src")) + mkspecs_concat);
- for (const QString &fb : qAsConst(feature_bases)) {
+ for (const QString &fb : std::as_const(feature_bases)) {
const auto sfxs = values(ProKey("QMAKE_PLATFORM"));
for (const ProString &sfx : sfxs)
feature_roots << (fb + features_concat + sfx + QLatin1Char('/'));
feature_roots << (fb + features_concat);
}
- for (int i = 0; i < feature_roots.count(); ++i)
+ for (int i = 0; i < feature_roots.size(); ++i)
if (!feature_roots.at(i).endsWith(QLatin1Char('/')))
feature_roots[i].append(QLatin1Char('/'));
feature_roots.removeDuplicates();
QStringList ret;
- for (const QString &root : qAsConst(feature_roots))
+ for (const QString &root : std::as_const(feature_roots))
if (IoUtils::exists(root))
ret << root;
m_featureRoots = new QMakeFeatureRoots(ret);
@@ -1595,7 +1573,7 @@ ProString QMakeEvaluator::propertyValue(const ProKey &name) const
ProFile *QMakeEvaluator::currentProFile() const
{
- if (m_profileStack.count() > 0)
+ if (m_profileStack.size() > 0)
return m_profileStack.top();
return nullptr;
}
@@ -1718,12 +1696,12 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateFunction(
m_locationStack.push(m_current);
ProStringList args;
- for (int i = 0; i < argumentsList.count(); ++i) {
+ for (int i = 0; i < argumentsList.size(); ++i) {
args += argumentsList[i];
m_valuemapStack.top()[ProKey(QString::number(i+1))] = argumentsList[i];
}
m_valuemapStack.top()[statics.strARGS] = args;
- m_valuemapStack.top()[statics.strARGC] = ProStringList(ProString(QString::number(argumentsList.count())));
+ m_valuemapStack.top()[statics.strARGC] = ProStringList(ProString(QString::number(argumentsList.size())));
vr = visitProBlock(func.pro(), func.tokPtr());
if (vr == ReturnReturn)
vr = ReturnTrue;
diff --git a/qmake/library/qmakeevaluator.h b/qmake/library/qmakeevaluator.h
index ef60649f5c..2889ac0bee 100644
--- a/qmake/library/qmakeevaluator.h
+++ b/qmake/library/qmakeevaluator.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** 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) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef QMAKEEVALUATOR_H
#define QMAKEEVALUATOR_H
diff --git a/qmake/library/qmakeevaluator_p.h b/qmake/library/qmakeevaluator_p.h
index eb997eebbe..ea18c3b45a 100644
--- a/qmake/library/qmakeevaluator_p.h
+++ b/qmake/library/qmakeevaluator_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** 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) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef QMAKEEVALUATOR_P_H
#define QMAKEEVALUATOR_P_H
diff --git a/qmake/library/qmakeglobals.cpp b/qmake/library/qmakeglobals.cpp
index 7d51b0f184..e05d33c7c9 100644
--- a/qmake/library/qmakeglobals.cpp
+++ b/qmake/library/qmakeglobals.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** 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) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "qmakeglobals.h"
@@ -114,7 +89,7 @@ QMakeGlobals::ArgumentReturn QMakeGlobals::addCommandLineArguments(
QMakeCmdLineParserState &state, QStringList &args, int *pos)
{
enum { ArgNone, ArgConfig, ArgSpec, ArgXSpec, ArgTmpl, ArgTmplPfx, ArgCache, ArgQtConf } argState = ArgNone;
- for (; *pos < args.count(); (*pos)++) {
+ for (; *pos < args.size(); (*pos)++) {
QString arg = args.at(*pos);
switch (argState) {
case ArgConfig:
@@ -193,7 +168,7 @@ void QMakeGlobals::commitCommandLineArguments(QMakeCmdLineParserState &state)
{
if (!state.extraargs.isEmpty()) {
QString extra = fL1S("QMAKE_EXTRA_ARGS =");
- for (const QString &ea : qAsConst(state.extraargs))
+ for (const QString &ea : std::as_const(state.extraargs))
extra += QLatin1Char(' ') + QMakeEvaluator::quoteValue(ProString(ea));
state.cmds[QMakeEvalBefore] << extra;
}
@@ -238,8 +213,8 @@ void QMakeGlobals::setDirectories(const QString &input_dir, const QString &outpu
QString dstpath = output_dir;
if (!dstpath.endsWith(QLatin1Char('/')))
dstpath += QLatin1Char('/');
- int srcLen = srcpath.length();
- int dstLen = dstpath.length();
+ int srcLen = srcpath.size();
+ int dstLen = dstpath.size();
int lastSl = -1;
while (++lastSl, --srcLen, --dstLen,
srcLen && dstLen && srcpath.at(srcLen) == dstpath.at(dstLen))
@@ -255,9 +230,9 @@ QString QMakeGlobals::shadowedPath(const QString &fileName) const
if (source_root.isEmpty())
return fileName;
if (fileName.startsWith(source_root)
- && (fileName.length() == source_root.length()
- || fileName.at(source_root.length()) == QLatin1Char('/'))) {
- return build_root + fileName.mid(source_root.length());
+ && (fileName.size() == source_root.size()
+ || fileName.at(source_root.size()) == QLatin1Char('/'))) {
+ return build_root + fileName.mid(source_root.size());
}
return QString();
}
@@ -268,7 +243,7 @@ QStringList QMakeGlobals::splitPathList(const QString &val) const
if (!val.isEmpty()) {
QString cwd(QDir::currentPath());
const QStringList vals = val.split(dirlist_sep, Qt::SkipEmptyParts);
- ret.reserve(vals.length());
+ ret.reserve(vals.size());
for (const QString &it : vals)
ret << IoUtils::resolvePath(cwd, it);
}
@@ -297,7 +272,7 @@ QString QMakeGlobals::expandEnvVars(const QString &str) const
startIndex = string.indexOf(QLatin1Char('$'), startIndex);
if (startIndex < 0)
break;
- if (string.length() < startIndex + 3)
+ if (string.size() < startIndex + 3)
break;
if (string.at(startIndex + 1) != QLatin1Char('(')) {
startIndex++;
@@ -308,7 +283,7 @@ QString QMakeGlobals::expandEnvVars(const QString &str) const
break;
QString value = getEnv(string.mid(startIndex + 2, endIndex - startIndex - 2));
string.replace(startIndex, endIndex - startIndex + 1, value);
- startIndex += value.length();
+ startIndex += value.size();
}
return string;
}
diff --git a/qmake/library/qmakeglobals.h b/qmake/library/qmakeglobals.h
index 55e70ac784..437f131786 100644
--- a/qmake/library/qmakeglobals.h
+++ b/qmake/library/qmakeglobals.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** 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) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef QMAKEGLOBALS_H
#define QMAKEGLOBALS_H
diff --git a/qmake/library/qmakeparser.cpp b/qmake/library/qmakeparser.cpp
index 52e4187dbb..ade2b091fe 100644
--- a/qmake/library/qmakeparser.cpp
+++ b/qmake/library/qmakeparser.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** 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) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "qmakeparser.h"
@@ -52,7 +27,7 @@ ProFileCache::ProFileCache()
ProFileCache::~ProFileCache()
{
- for (const Entry &ent : qAsConst(parsed_files))
+ for (const Entry &ent : std::as_const(parsed_files))
if (ent.pro)
ent.pro->deref();
QMakeVfs::deref();
@@ -359,7 +334,7 @@ void QMakeParser::read(ProFile *pro, QStringView in, int line, SubGrammar gramma
xprStack.reserve(10);
const ushort *cur = (const ushort *)in.data();
- const ushort *inend = cur + in.length();
+ const ushort *inend = cur + in.size();
m_canElse = false;
freshLine:
m_state = StNew;
@@ -757,7 +732,7 @@ void QMakeParser::read(ProFile *pro, QStringView in, int line, SubGrammar gramma
if (!m_blockstack.top().braceLevel) {
parseError(fL1S("Excess closing brace."));
} else if (!--m_blockstack.top().braceLevel
- && m_blockstack.count() != 1) {
+ && m_blockstack.size() != 1) {
leaveScope(tokPtr);
m_state = StNew;
m_canElse = false;
@@ -1271,7 +1246,7 @@ bool QMakeParser::resolveVariable(ushort *xprPtr, int tlen, int needSep, ushort
// The string is typically longer than the variable reference, so we need
// to ensure that there is enough space in the output buffer - as unlikely
// as an overflow is to actually happen in practice.
- int need = (in.length() - (cur - (const ushort *)in.constData()) + 2) * 5 + out.length();
+ int need = (in.size() - (cur - (const ushort *)in.constData()) + 2) * 5 + out.size();
int tused = *tokPtr - (ushort *)tokBuff->constData();
int xused;
int total;
@@ -1302,9 +1277,9 @@ bool QMakeParser::resolveVariable(ushort *xprPtr, int tlen, int needSep, ushort
}
xprPtr -= 2; // Was set up for variable reference
xprPtr[-2] = TokLiteral | needSep;
- xprPtr[-1] = out.length();
- memcpy(xprPtr, out.constData(), out.length() * 2);
- *ptr = xprPtr + out.length();
+ xprPtr[-1] = out.size();
+ memcpy(xprPtr, out.constData(), out.size() * 2);
+ *ptr = xprPtr + out.size();
return true;
}
@@ -1549,7 +1524,8 @@ static bool getBlock(const ushort *tokens, int limit, int &offset, QString *outS
ok = getSubBlock(tokens, limit, offset, outStr, indent, "block");
break;
default:
- Q_ASSERT(!"unhandled token");
+ // unhandled token
+ Q_UNREACHABLE();
}
}
if (!ok)
@@ -1563,7 +1539,7 @@ QString QMakeParser::formatProBlock(const QString &block)
QString outStr;
outStr += fL1S("\n << TS(");
int offset = 0;
- getBlock(reinterpret_cast<const ushort *>(block.constData()), block.length(),
+ getBlock(reinterpret_cast<const ushort *>(block.constData()), block.size(),
offset, &outStr, 0);
outStr += QLatin1Char(')');
return outStr;
diff --git a/qmake/library/qmakeparser.h b/qmake/library/qmakeparser.h
index 81aba061bc..a5a1192ec9 100644
--- a/qmake/library/qmakeparser.h
+++ b/qmake/library/qmakeparser.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** 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) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef QMAKEPARSER_H
#define QMAKEPARSER_H
diff --git a/qmake/library/qmakevfs.cpp b/qmake/library/qmakevfs.cpp
index a187749ee1..a8517de0ff 100644
--- a/qmake/library/qmakevfs.cpp
+++ b/qmake/library/qmakevfs.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** 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) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "qmakevfs.h"
diff --git a/qmake/library/qmakevfs.h b/qmake/library/qmakevfs.h
index 0c9a8dca36..56bda3d0a0 100644
--- a/qmake/library/qmakevfs.h
+++ b/qmake/library/qmakevfs.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** 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) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef QMAKEVFS_H
#define QMAKEVFS_H
diff --git a/qmake/library/registry.cpp b/qmake/library/registry.cpp
index 930e8e2ee6..7ab0c71fe6 100644
--- a/qmake/library/registry.cpp
+++ b/qmake/library/registry.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** 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) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QtCore/qstringlist.h>
#include "registry_p.h"
diff --git a/qmake/library/registry_p.h b/qmake/library/registry_p.h
index f9e8bba016..00f2431f69 100644
--- a/qmake/library/registry_p.h
+++ b/qmake/library/registry_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** 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) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef QT_WINDOWS_REGISTRY_H
#define QT_WINDOWS_REGISTRY_H
diff --git a/qmake/main.cpp b/qmake/main.cpp
index e99b33bd21..da2bd9eefb 100644
--- a/qmake/main.cpp
+++ b/qmake/main.cpp
@@ -1,31 +1,6 @@
-/****************************************************************************
-**
-** 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"
@@ -151,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;
@@ -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,7 +479,7 @@ 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;
@@ -556,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);
diff --git a/qmake/meta.cpp b/qmake/meta.cpp
index c5c14d9b56..99b08bb3a9 100644
--- a/qmake/meta.cpp
+++ b/qmake/meta.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** 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) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "meta.h"
#include "project.h"
diff --git a/qmake/meta.h b/qmake/meta.h
index 5f41a37df0..ec4d5fd5a6 100644
--- a/qmake/meta.h
+++ b/qmake/meta.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** 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) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef META_H
#define META_H
diff --git a/qmake/option.cpp b/qmake/option.cpp
index 72edf9c271..0e2d199232 100644
--- a/qmake/option.cpp
+++ b/qmake/option.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** 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) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "option.h"
#include "cachekeys.h"
@@ -37,6 +12,7 @@
#include <stdarg.h>
#include <qmakelibraryinfo.h>
+#include <qtversion.h>
#include <private/qlibraryinfo_p.h>
QT_BEGIN_NAMESPACE
@@ -101,7 +77,7 @@ static Option::QMAKE_MODE default_mode(QString progname)
{
int s = progname.lastIndexOf(QDir::separator());
if(s != -1)
- progname = progname.right(progname.length() - (s + 1));
+ progname = progname.right(progname.size() - (s + 1));
if(progname == "qmakegen")
return Option::QMAKE_GENERATE_PROJECT;
else if(progname == "qt-config")
@@ -109,15 +85,18 @@ static Option::QMAKE_MODE default_mode(QString progname)
return Option::QMAKE_GENERATE_MAKEFILE;
}
-static QString detectProjectFile(const QString &path)
+static QString detectProjectFile(const QString &path, QString *singleProFileCandidate = nullptr)
{
QString ret;
QDir dir(path);
- if(dir.exists(dir.dirName() + Option::pro_ext)) {
- ret = dir.filePath(dir.dirName()) + Option::pro_ext;
+ const QString candidate = dir.filePath(dir.dirName() + Option::pro_ext);
+ if (singleProFileCandidate)
+ *singleProFileCandidate = candidate;
+ if (QFile::exists(candidate)) {
+ ret = candidate;
} else { //last try..
QStringList profiles = dir.entryList(QStringList("*" + Option::pro_ext));
- if(profiles.count() == 1)
+ if(profiles.size() == 1)
ret = dir.filePath(profiles.at(0));
}
return ret;
@@ -195,7 +174,7 @@ Option::parseCommandLine(QStringList &args, QMakeCmdLineParserState &state)
{
enum { ArgNone, ArgOutput } argState = ArgNone;
int x = 0;
- while (x < args.count()) {
+ while (x < args.size()) {
switch (argState) {
case ArgOutput:
Option::output.setFileName(args.at(x--));
@@ -208,7 +187,8 @@ Option::parseCommandLine(QStringList &args, QMakeCmdLineParserState &state)
fprintf(stderr, "***Option %s requires a parameter\n", qPrintable(args.at(x - 1)));
return Option::QMAKE_CMDLINE_SHOW_USAGE | Option::QMAKE_CMDLINE_ERROR;
}
- QLibraryInfoPrivate::qtconfManualPath = globals->qtconf;
+ if (!globals->qtconf.isEmpty())
+ QLibraryInfoPrivate::setQtconfManualPath(&globals->qtconf);
if (cmdRet == QMakeGlobals::ArgumentsOk)
break;
Q_ASSERT(cmdRet == QMakeGlobals::ArgumentUnknown);
@@ -287,11 +267,20 @@ Option::parseCommandLine(QStringList &args, QMakeCmdLineParserState &state)
if(Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE ||
Option::qmake_mode == Option::QMAKE_GENERATE_PRL) {
if(fi.isDir()) {
- QString proj = detectProjectFile(arg);
- if (!proj.isNull())
- arg = proj;
+ QString singleProFileCandidate;
+ QString proj = detectProjectFile(arg, &singleProFileCandidate);
+ if (proj.isNull()) {
+ fprintf(stderr, "***Cannot detect .pro file in directory '%s'.\n\n"
+ "QMake expects the file '%s' "
+ "or exactly one .pro file in the given directory.\n",
+ qUtf8Printable(arg),
+ qUtf8Printable(singleProFileCandidate));
+ return Option::QMAKE_CMDLINE_ERROR;
+ }
+ Option::mkfile::project_files.append(proj);
+ } else {
+ Option::mkfile::project_files.append(arg);
}
- Option::mkfile::project_files.append(arg);
} else if(Option::qmake_mode == Option::QMAKE_GENERATE_PROJECT) {
Option::projfile::project_dirs.append(arg);
} else {
@@ -401,7 +390,7 @@ Option::init(int argc, char **argv)
} else if (opt == "-qtconf") {
// Skip "-qtconf <file>" and proceed.
++idx;
- if (idx + 1 < args.length())
+ if (idx + 1 < args.size())
++idx;
continue;
} else {
@@ -476,7 +465,7 @@ bool Option::postProcessProject(QMakeProject *project)
if (!project->buildRoot().isEmpty() && Option::output_dir.startsWith(project->buildRoot()))
Option::mkfile::cachefile_depth =
- Option::output_dir.mid(project->buildRoot().length()).count('/');
+ Option::output_dir.mid(project->buildRoot().size()).count('/');
return true;
}
@@ -539,7 +528,7 @@ Option::fixString(QString string, uchar flags)
if ((string.startsWith("\"") && string.endsWith("\"")) ||
(string.startsWith("\'") && string.endsWith("\'")))
- string = string.mid(1, string.length()-2);
+ string = string.mid(1, string.size()-2);
//cache
//qDebug() << "Fix" << orig_string << "->" << string;
@@ -618,7 +607,7 @@ public:
*data = nullptr;
}
};
-static QList<QMakeCacheClearItem*> cache_items;
+Q_CONSTINIT static QList<QMakeCacheClearItem*> cache_items;
void
qmakeClearCaches()
diff --git a/qmake/option.h b/qmake/option.h
index a6ad9fe250..7d1427c37a 100644
--- a/qmake/option.h
+++ b/qmake/option.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** 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) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef OPTION_H
#define OPTION_H
diff --git a/qmake/project.cpp b/qmake/project.cpp
index 066ac1838f..462c8d709a 100644
--- a/qmake/project.cpp
+++ b/qmake/project.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** 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) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "project.h"
@@ -163,7 +138,7 @@ void QMakeProject::dump() const
}
}
out.sort();
- for (const QString &v : qAsConst(out))
+ for (const QString &v : std::as_const(out))
puts(qPrintable(v));
}
diff --git a/qmake/project.h b/qmake/project.h
index da08e86f44..9a6dbb16e0 100644
--- a/qmake/project.h
+++ b/qmake/project.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** 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) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef PROJECT_H
#define PROJECT_H
diff --git a/qmake/property.cpp b/qmake/property.cpp
index 2a1c4170b9..32b6729c13 100644
--- a/qmake/property.cpp
+++ b/qmake/property.cpp
@@ -1,35 +1,11 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** 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) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "property.h"
#include <qdir.h>
#include <qsettings.h>
+#include <qtversion.h>
#include <qmakelibraryinfo.h>
#include <qstringlist.h>
#include <stdio.h>
@@ -171,7 +147,7 @@ int QMakeProperty::queryProperty(const QStringList &optionProperties,
#ifdef QT_VERSION_STR
specialProps.append("QT_VERSION");
#endif
- for (const QString &prop : qAsConst(specialProps)) {
+ for (const QString &prop : std::as_const(specialProps)) {
ProString val = value(ProKey(prop));
ProString pval = value(ProKey(prop + "/raw"));
ProString gval = value(ProKey(prop + "/get"));
diff --git a/qmake/property.h b/qmake/property.h
index 7b41a7ad83..95c9f43bd4 100644
--- a/qmake/property.h
+++ b/qmake/property.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** 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) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef PROPERTY_H
#define PROPERTY_H
diff --git a/qmake/propertyprinter.cpp b/qmake/propertyprinter.cpp
index d59e99f824..52a790e2c8 100644
--- a/qmake/propertyprinter.cpp
+++ b/qmake/propertyprinter.cpp
@@ -1,52 +1,20 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** 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-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "propertyprinter.h"
#include <iostream>
+#include <QJsonDocument>
+#include <QJsonObject>
+#include <QJsonValue>
+
QT_BEGIN_NAMESPACE
void qmakePropertyPrinter(const QList<QPair<QString, QString>> &values)
{
// Assume single property request
- if (values.count() == 1) {
+ if (values.size() == 1) {
std::cout << qPrintable(values.at(0).second) << std::endl;
return;
}
@@ -58,11 +26,12 @@ void qmakePropertyPrinter(const QList<QPair<QString, QString>> &values)
void jsonPropertyPrinter(const QList<QPair<QString, QString>> &values)
{
- std::cout << "{\n";
- for (const auto &val : values) {
- std::cout << "\"" << qPrintable(val.first) << "\":\"" << qPrintable(val.second) << "\",\n";
- }
- std::cout << "}\n";
+ QJsonObject object;
+ for (const auto &val : values)
+ object.insert(val.first, val.second);
+
+ QJsonDocument document(object);
+ std::cout << document.toJson().constData();
}
QT_END_NAMESPACE
diff --git a/qmake/propertyprinter.h b/qmake/propertyprinter.h
index c885d5b055..90fa3a4274 100644
--- a/qmake/propertyprinter.h
+++ b/qmake/propertyprinter.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** 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-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef PROPERTYPRINTER_H
#define PROPERTYPRINTER_H
diff --git a/qmake/qmake_pch.h b/qmake/qmake_pch.h
index fd8c78d7b6..741c55aa46 100644
--- a/qmake/qmake_pch.h
+++ b/qmake/qmake_pch.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** 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) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef QMAKE_PCH_H
#define QMAKE_PCH_H
diff --git a/qmake/qmakelibraryinfo.cpp b/qmake/qmakelibraryinfo.cpp
index 59a4e6eb59..a840036613 100644
--- a/qmake/qmakelibraryinfo.cpp
+++ b/qmake/qmakelibraryinfo.cpp
@@ -1,42 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 The Qt Company Ltd.
-** Copyright (C) 2016 Intel Corporation.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** 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-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2021 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 "qmakelibraryinfo.h"
@@ -112,7 +76,7 @@ void QMakeLibraryInfo::sysrootify(QString &path)
if (sysroot.isEmpty())
return;
- if (path.length() > 2 && path.at(1) == QLatin1Char(':')
+ if (path.size() > 2 && path.at(1) == QLatin1Char(':')
&& (path.at(2) == QLatin1Char('/') || path.at(2) == QLatin1Char('\\'))) {
path.replace(0, 2, sysroot); // Strip out the drive on Windows targets
} else {
@@ -169,17 +133,22 @@ static QLibraryInfoPrivate::LocationInfo defaultLocationInfo(int loc)
return result;
}
+static QString libraryInfoPath(QLibraryInfo::LibraryPath location)
+{
+ return QLibraryInfoPrivate::path(location, QLibraryInfoPrivate::UsedFromQtBinDir);
+}
+
static QString storedPath(int loc)
{
QString result;
if (loc < QMakeLibraryInfo::FirstHostPath) {
- result = QLibraryInfo::path(static_cast<QLibraryInfo::LibraryPath>(loc));
+ result = libraryInfoPath(static_cast<QLibraryInfo::LibraryPath>(loc));
} else if (loc <= QMakeLibraryInfo::LastHostPath) {
if (loc == QMakeLibraryInfo::HostDataPath) {
// Handle QT_HOST_DATADIR specially. It is not necessarily equal to QT_INSTALL_DATA.
result = QT_HOST_DATADIR;
} else {
- result = QLibraryInfo::path(hostToTargetPathEnum(loc));
+ result = libraryInfoPath(hostToTargetPathEnum(loc));
}
} else if (loc == QMakeLibraryInfo::SysrootPath) {
// empty result
@@ -223,11 +192,11 @@ QString QMakeLibraryInfo::rawLocation(int loc, QMakeLibraryInfo::PathGroup group
: "Paths"));
if (locinfo.fallbackKey.isNull()) {
- ret = config->value(locinfo.key, locinfo.defaultValue).toString();
+ ret = config->value(locinfo.key).toString();
} else {
QVariant v = config->value(locinfo.key);
if (!v.isValid())
- v = config->value(locinfo.fallbackKey, locinfo.defaultValue);
+ v = config->value(locinfo.fallbackKey);
ret = v.toString();
}
@@ -248,7 +217,7 @@ QString QMakeLibraryInfo::rawLocation(int loc, QMakeLibraryInfo::PathGroup group
startIndex = ret.indexOf(QLatin1Char('$'), startIndex);
if (startIndex < 0)
break;
- if (ret.length() < startIndex + 3)
+ if (ret.size() < startIndex + 3)
break;
if (ret.at(startIndex + 1) != QLatin1Char('(')) {
startIndex++;
@@ -262,7 +231,7 @@ QString QMakeLibraryInfo::rawLocation(int loc, QMakeLibraryInfo::PathGroup group
QString value =
QString::fromLocal8Bit(qgetenv(envVarName.toLocal8Bit().constData()));
ret.replace(startIndex, endIndex - startIndex + 1, value);
- startIndex += value.length();
+ startIndex += value.size();
}
config->endGroup();
diff --git a/qmake/qmakelibraryinfo.h b/qmake/qmakelibraryinfo.h
index 71cc3fc78a..c3240efd15 100644
--- a/qmake/qmakelibraryinfo.h
+++ b/qmake/qmakelibraryinfo.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** 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-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef QMAKELIBRARYINFO_H
#define QMAKELIBRARYINFO_H