summaryrefslogtreecommitdiffstats
path: root/qmake
diff options
context:
space:
mode:
Diffstat (limited to 'qmake')
-rw-r--r--qmake/CMakeLists.txt39
-rw-r--r--qmake/cachekeys.h2
-rw-r--r--qmake/doc/qmake.qdocconf3
-rw-r--r--qmake/doc/snippets/code/doc_src_qmake-manual.pro22
-rw-r--r--qmake/doc/src/qmake-manual.qdoc303
-rw-r--r--qmake/generators/mac/pbuilder_pbx.cpp50
-rw-r--r--qmake/generators/makefile.cpp123
-rw-r--r--qmake/generators/makefile.h3
-rw-r--r--qmake/generators/makefiledeps.cpp4
-rw-r--r--qmake/generators/metamakefile.cpp27
-rw-r--r--qmake/generators/projectgenerator.cpp30
-rw-r--r--qmake/generators/unix/unixmake.cpp19
-rw-r--r--qmake/generators/unix/unixmake2.cpp54
-rw-r--r--qmake/generators/win32/mingw_make.cpp6
-rw-r--r--qmake/generators/win32/msbuild_objectmodel.cpp46
-rw-r--r--qmake/generators/win32/msvc_nmake.cpp23
-rw-r--r--qmake/generators/win32/msvc_objectmodel.cpp55
-rw-r--r--qmake/generators/win32/msvc_objectmodel.h1
-rw-r--r--qmake/generators/win32/msvc_vcproj.cpp42
-rw-r--r--qmake/generators/win32/winmakefile.cpp16
-rw-r--r--qmake/generators/xmloutput.cpp12
-rw-r--r--qmake/library/ioutils.cpp32
-rw-r--r--qmake/library/proitems.cpp29
-rw-r--r--qmake/library/qmakebuiltins.cpp92
-rw-r--r--qmake/library/qmakeevaluator.cpp33
-rw-r--r--qmake/library/qmakeglobals.cpp20
-rw-r--r--qmake/library/qmakeparser.cpp16
-rw-r--r--qmake/main.cpp6
-rw-r--r--qmake/option.cpp18
-rw-r--r--qmake/project.cpp2
-rw-r--r--qmake/property.cpp10
-rw-r--r--qmake/propertyprinter.cpp19
-rw-r--r--qmake/propertyprinter.h2
-rw-r--r--qmake/qmakelibraryinfo.cpp8
-rw-r--r--qmake/qmakelibraryinfo.h2
35 files changed, 545 insertions, 624 deletions
diff --git a/qmake/CMakeLists.txt b/qmake/CMakeLists.txt
index 8b74b85c49..5a54570194 100644
--- a/qmake/CMakeLists.txt
+++ b/qmake/CMakeLists.txt
@@ -16,14 +16,14 @@ qt_add_library(QtLibraryInfo OBJECT
qmakelibraryinfo.cpp qmakelibraryinfo.h
)
+# 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)
-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>
-)
target_include_directories(QtLibraryInfo PUBLIC
"${CMAKE_CURRENT_SOURCE_DIR}"
"${CMAKE_CURRENT_SOURCE_DIR}/library"
@@ -35,23 +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_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
@@ -92,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()
@@ -113,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
@@ -121,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 ffe40fb783..d364912ee5 100644
--- a/qmake/cachekeys.h
+++ b/qmake/cachekeys.h
@@ -65,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 f0ab617801..4de19f3f67 100644
--- a/qmake/doc/qmake.qdocconf
+++ b/qmake/doc/qmake.qdocconf
@@ -59,6 +59,3 @@ depends += \
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.pro b/qmake/doc/snippets/code/doc_src_qmake-manual.pro
index 76f0eec2fe..bb803d11b6 100644
--- a/qmake/doc/snippets/code/doc_src_qmake-manual.pro
+++ b/qmake/doc/snippets/code/doc_src_qmake-manual.pro
@@ -961,3 +961,25 @@ 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/src/qmake-manual.qdoc b/qmake/doc/src/qmake-manual.qdoc
index 41611be0e5..31d3f824e7 100644
--- a/qmake/doc/src/qmake-manual.qdoc
+++ b/qmake/doc/src/qmake-manual.qdoc
@@ -118,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
@@ -154,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
@@ -272,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
@@ -321,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
@@ -488,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
@@ -551,7 +553,6 @@
files.
\endlist
- \target MakefileMode
\section1 Makefile Mode Options
\snippet code/doc_src_qmake-manual.pro 9
@@ -593,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
@@ -884,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.
@@ -902,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.
@@ -910,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.
@@ -923,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.
@@ -935,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.
@@ -954,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.
@@ -964,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.
@@ -987,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.
@@ -1028,7 +1020,6 @@
ANDROID_EXTRA_PLUGINS += $$top_builddir/plugins
\endcode
- \target ANDROID_FEATURES
\section1 ANDROID_FEATURES
\note This variable applies only to Android modules.
@@ -1041,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.
@@ -1054,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.
@@ -1062,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.
@@ -1083,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.
@@ -1096,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.
@@ -1112,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.
@@ -1120,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
@@ -1280,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
@@ -1300,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.
@@ -1391,7 +1374,6 @@
\snippet code/doc_src_qmake-manual.pro 26
- \target DEFINES
\section1 DEFINES
qmake adds the values of this variable as
@@ -1401,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
@@ -1411,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
@@ -1424,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.
@@ -1451,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
@@ -1461,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
@@ -1486,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
@@ -1507,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.
@@ -1522,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
@@ -1550,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
@@ -1604,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
@@ -1636,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.
@@ -1660,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.
@@ -1673,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
@@ -1687,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
@@ -1702,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
@@ -1718,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.
@@ -1732,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.
@@ -1742,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
@@ -1759,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,
@@ -1771,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,
@@ -1782,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
@@ -1791,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
@@ -1803,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
@@ -1811,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
@@ -1819,14 +1766,12 @@
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}. If you have
@@ -1835,7 +1780,6 @@
See \l{Qt Creator: Using QML Modules with Plugins} for details.
- \target QMLPATHS
\section1 QMLPATHS
Expects a list of import paths that point to root directories of trees of
@@ -1853,17 +1797,15 @@
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()
- \target QMAKE_systemvariable
\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
@@ -1871,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.
@@ -1879,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.
@@ -1958,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
@@ -1980,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.
@@ -1990,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
@@ -1998,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
@@ -2034,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
@@ -2056,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.
@@ -2064,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
@@ -2079,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.
@@ -2087,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.
@@ -2095,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
@@ -2110,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
@@ -2121,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
@@ -2179,7 +2114,6 @@
See also \l{Adding Custom Targets}.
- \target QMAKE_FAILED_REQUIREMENTS
\section1 QMAKE_FAILED_REQUIREMENTS
Contains the list of failed requirements.
@@ -2200,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.
@@ -2214,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.
@@ -2233,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
@@ -2249,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
@@ -2273,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
@@ -2285,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.
@@ -2295,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.
@@ -2314,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,
@@ -2386,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.
@@ -2654,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
@@ -2680,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
@@ -2690,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.
@@ -2823,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
@@ -2831,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
@@ -2839,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;
@@ -2848,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
@@ -2856,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;
@@ -2865,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
@@ -2873,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
@@ -2881,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;
@@ -2890,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.
@@ -2991,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.
@@ -3016,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
@@ -3031,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
@@ -3039,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
@@ -3050,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.
@@ -3059,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,
@@ -3068,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)
@@ -3084,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.
@@ -3095,7 +3001,6 @@
See also \l{#HEADERS}{HEADERS}.
- \target SUBDIRS
\section1 SUBDIRS
This variable, when used with the \c subdirs \l{#TEMPLATE}{template}
@@ -3157,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
@@ -3190,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
@@ -3227,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
@@ -3245,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
@@ -3255,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
@@ -3306,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
@@ -3315,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
@@ -3323,7 +3240,6 @@
Defaults to \c{WINDOWS_TARGET_PLATFORM_VERSION}.
- \target YACCSOURCES
\section1 YACCSOURCES
Specifies a list of Yacc source files to be included
@@ -3403,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
@@ -3455,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
@@ -3471,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.
@@ -3480,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
@@ -3533,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.
@@ -3542,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])
@@ -3563,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
@@ -3590,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,
@@ -3724,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)
@@ -3743,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.
@@ -3761,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:
@@ -3791,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
@@ -3814,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
@@ -3845,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
@@ -3855,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
@@ -3867,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.
@@ -3947,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
@@ -4026,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
@@ -4171,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
@@ -4392,7 +4299,6 @@
\snippet code/doc_src_qmake-manual.pro 78
- \target QMAKESPEC
\section1 QMAKESPEC
qmake requires a platform and compiler
@@ -4416,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
@@ -4429,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
@@ -4450,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
@@ -4531,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
@@ -4591,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.
@@ -4718,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
@@ -4751,7 +4653,6 @@
\snippet code/doc_src_qmake-manual.pro 100
- \target UsingReplaceFunctions
\section1 Replace Functions
qmake provides a selection of built-in
@@ -4777,7 +4678,6 @@
\snippet qmake/replacefunction.pro 0
- \target UsingTestFunctions
\section1 Test Functions
qmake provides built-in functions that can be
@@ -5096,7 +4996,6 @@
to be linked in.
\endtable
- \target LibDepend
\section1 Library Dependencies
Often when linking against a library, qmake
@@ -5150,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
@@ -5179,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
@@ -5192,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
@@ -5232,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
@@ -5546,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
@@ -5572,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.
@@ -5666,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
@@ -5695,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
@@ -5709,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
@@ -5720,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 efc7528c56..d0d560aca9 100644
--- a/qmake/generators/mac/pbuilder_pbx.cpp
+++ b/qmake/generators/mac/pbuilder_pbx.cpp
@@ -87,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)) {
@@ -329,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"
@@ -429,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";
}
@@ -524,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);
}
}
}
@@ -658,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,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;
@@ -912,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();
}
@@ -921,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";
@@ -955,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();
@@ -1008,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();
@@ -1148,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"))
@@ -1158,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);
@@ -1181,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;
}
@@ -1684,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/";
@@ -1888,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;
}
@@ -1970,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/makefile.cpp b/qmake/generators/makefile.cpp
index 06ca1807a7..482ef2e269 100644
--- a/qmake/generators/makefile.cpp
+++ b/qmake/generators/makefile.cpp
@@ -16,7 +16,7 @@
#include <qdebug.h>
#include <qbuffer.h>
#include <qdatetime.h>
-#include <qlibraryinfo.h>
+#include <qtversion.h>
#if defined(Q_OS_UNIX)
#include <unistd.h>
@@ -39,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;
@@ -113,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));
}
@@ -238,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()) {
@@ -288,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);
@@ -312,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());
}
}
@@ -338,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);
+ }
}
}
@@ -468,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;
@@ -491,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");
@@ -512,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
@@ -525,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);
@@ -613,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)
@@ -634,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())
@@ -653,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
@@ -764,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);
@@ -820,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]);
}
}
@@ -1031,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;
@@ -1173,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);
@@ -1249,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)) {
@@ -1316,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));
@@ -1616,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
@@ -1682,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();
}
@@ -1883,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) {
@@ -1961,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())
@@ -1986,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));
@@ -1997,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();
}
@@ -2263,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;
@@ -2298,7 +2307,7 @@ MakefileGenerator::writeHeader(QTextStream &t)
{
t << "#############################################################################\n";
t << "# Makefile for building: " << escapeFilePath(var("TARGET")) << Qt::endl;
- t << "# Generated by qmake (" QMAKE_VERSION_STR ") (Qt " << qVersion() << ")\n";
+ t << "# Generated by qmake (" QMAKE_VERSION_STR ") (Qt " QT_VERSION_STR ")\n";
t << "# Project: " << fileFixify(project->projectFile()) << Qt::endl;
t << "# Template: " << var("TEMPLATE") << Qt::endl;
if(!project->isActiveConfig("build_pass"))
@@ -2382,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");
@@ -2521,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) + " && ";
@@ -2534,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) {
@@ -2699,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;
@@ -2714,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);
}
@@ -2850,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;
@@ -3016,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;
@@ -3038,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);
@@ -3112,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;
@@ -3233,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('.');
@@ -3538,7 +3547,7 @@ MakefileGenerator::LinkerResponseFileInfo MakefileGenerator::maybeCreateLinkerRe
// 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.count() < threshold)
+ if (linkerInputs.size() < threshold)
return {};
} else {
// When using QMAKE_REPONSEFILE_THRESHOLD, try to determine the command line length of the
diff --git a/qmake/generators/makefile.h b/qmake/generators/makefile.h
index 854defb1a0..6ab4ad505d 100644
--- a/qmake/generators/makefile.h
+++ b/qmake/generators/makefile.h
@@ -145,7 +145,8 @@ protected:
CompilerBuiltin = 0x01,
CompilerNoCheckDeps = 0x02,
CompilerRemoveNoExist = 0x04,
- CompilerAddInputsAsMakefileDeps = 0x08
+ CompilerWarnNoExist = 0x08,
+ CompilerAddInputsAsMakefileDeps = 0x10
};
uint flags, type;
};
diff --git a/qmake/generators/makefiledeps.cpp b/qmake/generators/makefiledeps.cpp
index c8f4772dcb..8e8d42cc96 100644
--- a/qmake/generators/makefiledeps.cpp
+++ b/qmake/generators/makefiledeps.cpp
@@ -164,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));
}
@@ -809,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()) {
diff --git a/qmake/generators/metamakefile.cpp b/qmake/generators/metamakefile.cpp
index 9616e560b5..79443a1d4b 100644
--- a/qmake/generators/metamakefile.cpp
+++ b/qmake/generators/metamakefile.cpp
@@ -52,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)
@@ -73,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)
@@ -91,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;
@@ -126,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];
@@ -140,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() &&
@@ -223,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;
@@ -234,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);
@@ -324,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
@@ -391,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+"/"+
@@ -414,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/projectgenerator.cpp b/qmake/generators/projectgenerator.cpp
index 8e9e8cd37f..96d7b26370 100644
--- a/qmake/generators/projectgenerator.cpp
+++ b/qmake/generators/projectgenerator.cpp
@@ -54,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)) {
@@ -66,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;
@@ -87,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;
@@ -116,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;
@@ -129,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 = "";
@@ -143,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);
@@ -155,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));
{
@@ -170,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)) {
@@ -231,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"];
@@ -358,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;
@@ -428,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/unix/unixmake.cpp b/qmake/generators/unix/unixmake.cpp
index 54c8d6e6a3..c6771e7ab9 100644
--- a/qmake/generators/unix/unixmake.cpp
+++ b/qmake/generators/unix/unixmake.cpp
@@ -14,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));
@@ -48,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);
}
@@ -101,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();
@@ -241,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")))) {
@@ -299,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());
@@ -337,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}"),
@@ -392,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))
@@ -418,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))
@@ -436,7 +435,7 @@ UnixMakefileGenerator::findLibraries(bool linkPrl, bool mergeLflags)
break;
}
} else {
- if (opt.length() == 10)
+ if (opt.size() == 10)
++it;
// Skip
}
@@ -689,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/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp
index 1b2989b978..96036eba70 100644
--- a/qmake/generators/unix/unixmake2.cpp
+++ b/qmake/generators/unix/unixmake2.cpp
@@ -10,7 +10,7 @@
#include <qfile.h>
#include <qdir.h>
#include <qdebug.h>
-#include <qlibraryinfo.h>
+#include <qtversion.h>
#include <time.h>
#include <tuple>
@@ -105,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);
@@ -121,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),
@@ -303,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;
}
}
@@ -311,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;
}
}
@@ -388,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") {
@@ -489,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") {
@@ -804,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/";
@@ -836,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");
@@ -870,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))
@@ -977,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");
@@ -1008,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());
@@ -1106,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());
@@ -1395,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);
@@ -1465,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;
@@ -1476,7 +1478,7 @@ UnixMakefileGenerator::writeLibtoolFile()
QTextStream t(&ft);
t << "# " << lname << " - a libtool library file\n";
t << "# Generated by qmake/libtool (" QMAKE_VERSION_STR ") (Qt "
- << qVersion() << ")";
+ << QT_VERSION_STR << ")";
t << "\n";
t << "# The name that we can dlopen(3).\n"
@@ -1495,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";
@@ -1558,9 +1560,9 @@ bool UnixMakefileGenerator::writeObjectsPart(QTextStream &t, bool do_incremental
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;
diff --git a/qmake/generators/win32/mingw_make.cpp b/qmake/generators/win32/mingw_make.cpp
index b8f6e54593..7f798a2cc6 100644
--- a/qmake/generators/win32/mingw_make.cpp
+++ b/qmake/generators/win32/mingw_make.cpp
@@ -191,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('\\', '/');
@@ -250,7 +250,7 @@ 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 << " " ;
@@ -273,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/msbuild_objectmodel.cpp b/qmake/generators/win32/msbuild_objectmodel.cpp
index ba3bc37088..9bbeed36ff 100644
--- a/qmake/generators/win32/msbuild_objectmodel.cpp
+++ b/qmake/generators/win32/msbuild_objectmodel.cpp
@@ -283,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);
}
@@ -301,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;
}
@@ -512,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);
@@ -544,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();
@@ -559,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));
}
@@ -574,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;
}
@@ -589,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)
@@ -613,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");
@@ -623,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");
@@ -641,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);
@@ -708,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")
@@ -751,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);
@@ -774,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();
@@ -788,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");
@@ -1737,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")
@@ -1759,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));
}
@@ -1789,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;
@@ -1812,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/msvc_nmake.cpp b/qmake/generators/win32/msvc_nmake.cpp
index 7e0eb4ed41..b5df617927 100644
--- a/qmake/generators/win32/msvc_nmake.cpp
+++ b/qmake/generators/win32/msvc_nmake.cpp
@@ -6,7 +6,7 @@
#include <qregularexpression.h>
#include <qdir.h>
-#include <qdiriterator.h>
+#include <qdirlisting.h>
#include <qset.h>
#include <time.h>
@@ -264,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;
}
@@ -290,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);
}
@@ -314,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;
}
}
@@ -339,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_objectmodel.cpp b/qmake/generators/win32/msvc_objectmodel.cpp
index 62214bb66a..6517e5c451 100644
--- a/qmake/generators/win32/msvc_objectmodel.cpp
+++ b/qmake/generators/win32/msvc_objectmodel.cpp
@@ -862,7 +862,7 @@ bool VCCLCompilerTool::parseOption(const char* option)
}
break;
}
- // Fallthrough
+ [[fallthrough]];
default:
found = false; break;
}
@@ -1478,7 +1478,8 @@ bool VCLinkerTool::parseOption(const char* option)
EnableUAC = _True;
break;
case 0x3389797: // /DEBUG[:{FASTLINK|FULL|NONE}]
- if (config->CompilerVersion >= NET2015) {
+ DebugInfoOption = linkerDebugOptionEnabled;
+ if (config->CompilerVersion >= NET2015 && *(option + 6) == ':') {
const char *str = option + 7;
if (qstricmp(str, "fastlink") == 0)
DebugInfoOption = linkerDebugOptionFastLink;
@@ -1539,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;
@@ -1728,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;
@@ -2231,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());
}
@@ -2271,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;
}
@@ -2304,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;
@@ -2330,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(' ')));
}
@@ -2342,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)
@@ -2387,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),
@@ -2396,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);
@@ -2432,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);
@@ -2450,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;
@@ -2461,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();
@@ -2496,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);
@@ -2576,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;
@@ -2584,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");
@@ -2595,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;
}
@@ -2615,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);
@@ -2628,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");
@@ -2930,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()) {
@@ -2940,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))
@@ -2964,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
@@ -3003,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 f0869d510f..190d6c727f 100644
--- a/qmake/generators/win32/msvc_objectmodel.h
+++ b/qmake/generators/win32/msvc_objectmodel.h
@@ -258,6 +258,7 @@ enum inlineExpansionOption {
};
enum linkerDebugOption {
linkerDebugOptionNone,
+ linkerDebugOptionEnabled, // represents /DEBUG without further options
linkerDebugOptionFastLink,
linkerDebugOptionFull
};
diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp
index 6116ed9376..2192535867 100644
--- a/qmake/generators/win32/msvc_vcproj.cpp
+++ b/qmake/generators/win32/msvc_vcproj.cpp
@@ -8,7 +8,7 @@
#include <ioutils.h>
#include <qdir.h>
-#include <qdiriterator.h>
+#include <qdirlisting.h>
#include <qcryptographichash.h>
#include <qhash.h>
#include <quuid.h>
@@ -142,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();
@@ -349,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()) {
@@ -418,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()) {
@@ -634,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")
@@ -767,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;
@@ -1213,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;
@@ -1293,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;";
@@ -1553,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(
@@ -1568,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/winmakefile.cpp b/qmake/generators/win32/winmakefile.cpp
index 4f56bad28a..c8317389f5 100644
--- a/qmake/generators/win32/winmakefile.cpp
+++ b/qmake/generators/win32/winmakefile.cpp
@@ -174,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);
}
@@ -479,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();
}
@@ -508,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();
}
@@ -686,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;
@@ -749,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/xmloutput.cpp b/qmake/generators/xmloutput.cpp
index 713c1eca44..be64176f33 100644
--- a/qmake/generators/xmloutput.cpp
+++ b/qmake/generators/xmloutput.cpp
@@ -240,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");
@@ -271,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();
@@ -280,7 +280,7 @@ void XmlOutput::closeTo(const QString &tag)
void XmlOutput::closeAll()
{
- if (!tagStack.count())
+ if (!tagStack.size())
return;
closeTo(QString());
}
@@ -315,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:
@@ -333,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/library/ioutils.cpp b/qmake/library/ioutils.cpp
index 5a5c455264..38bb246341 100644
--- a/qmake/library/ioutils.cpp
+++ b/qmake/library/ioutils.cpp
@@ -9,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>
@@ -136,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;
}
@@ -151,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);
@@ -179,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);
@@ -195,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;
@@ -212,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
@@ -255,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;
@@ -265,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/proitems.cpp b/qmake/library/proitems.cpp
index 1843f693d5..2edd40a35c 100644
--- a/qmake/library/proitems.cpp
+++ b/qmake/library/proitems.cpp
@@ -40,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)
{
}
@@ -84,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
@@ -121,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();
}
@@ -144,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;
@@ -156,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);
@@ -172,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);
@@ -192,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;
@@ -223,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;
@@ -242,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/qmakebuiltins.cpp b/qmake/library/qmakebuiltins.cpp
index df7236f106..f885bb19c3 100644
--- a/qmake/library/qmakebuiltins.cpp
+++ b/qmake/library/qmakebuiltins.cpp
@@ -225,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);
@@ -246,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);
@@ -546,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;
}
@@ -595,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];
@@ -630,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;
@@ -642,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="))) {
@@ -687,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) {
@@ -703,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;
@@ -722,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()) {
@@ -742,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.
@@ -816,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))
@@ -883,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))
@@ -893,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)));
}
@@ -936,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('\\')) {
@@ -981,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);
@@ -996,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);
@@ -1022,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) {
@@ -1044,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('?')))
@@ -1091,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()) {
@@ -1103,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())
@@ -1114,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: {
@@ -1131,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());
@@ -1141,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());
@@ -1252,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")) {
@@ -1272,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."));
@@ -1367,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()) {
@@ -1425,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")) {
@@ -1512,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);
@@ -1562,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]);
}
@@ -1589,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)
@@ -1605,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;
@@ -1622,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);
@@ -1710,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);
@@ -1745,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)
@@ -1844,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 2e4a3e27d1..df3f92d7d5 100644
--- a/qmake/library/qmakeevaluator.cpp
+++ b/qmake/library/qmakeevaluator.cpp
@@ -256,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++) {
@@ -801,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
@@ -853,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;
@@ -1013,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())
@@ -1233,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;
@@ -1475,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())
@@ -1516,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()) {
@@ -1538,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);
@@ -1570,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;
}
@@ -1693,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/qmakeglobals.cpp b/qmake/library/qmakeglobals.cpp
index 34c443b50e..e05d33c7c9 100644
--- a/qmake/library/qmakeglobals.cpp
+++ b/qmake/library/qmakeglobals.cpp
@@ -89,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:
@@ -168,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;
}
@@ -213,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))
@@ -230,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();
}
@@ -243,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);
}
@@ -272,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++;
@@ -283,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/qmakeparser.cpp b/qmake/library/qmakeparser.cpp
index 98540c93dc..ade2b091fe 100644
--- a/qmake/library/qmakeparser.cpp
+++ b/qmake/library/qmakeparser.cpp
@@ -27,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();
@@ -334,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;
@@ -732,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;
@@ -1246,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;
@@ -1277,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;
}
@@ -1539,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/main.cpp b/qmake/main.cpp
index 9b96ab7338..da2bd9eefb 100644
--- a/qmake/main.cpp
+++ b/qmake/main.cpp
@@ -126,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;
@@ -479,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;
@@ -531,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/option.cpp b/qmake/option.cpp
index 55f21120c0..0e2d199232 100644
--- a/qmake/option.cpp
+++ b/qmake/option.cpp
@@ -12,7 +12,7 @@
#include <stdarg.h>
#include <qmakelibraryinfo.h>
-#include <qlibraryinfo.h>
+#include <qtversion.h>
#include <private/qlibraryinfo_p.h>
QT_BEGIN_NAMESPACE
@@ -77,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")
@@ -96,7 +96,7 @@ static QString detectProjectFile(const QString &path, QString *singleProFileCand
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;
@@ -174,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--));
@@ -188,7 +188,7 @@ Option::parseCommandLine(QStringList &args, QMakeCmdLineParserState &state)
return Option::QMAKE_CMDLINE_SHOW_USAGE | Option::QMAKE_CMDLINE_ERROR;
}
if (!globals->qtconf.isEmpty())
- QLibraryInfoPrivate::qtconfManualPath = &globals->qtconf;
+ QLibraryInfoPrivate::setQtconfManualPath(&globals->qtconf);
if (cmdRet == QMakeGlobals::ArgumentsOk)
break;
Q_ASSERT(cmdRet == QMakeGlobals::ArgumentUnknown);
@@ -200,7 +200,7 @@ Option::parseCommandLine(QStringList &args, QMakeCmdLineParserState &state)
fprintf(stdout,
"QMake version %s\n"
"Using Qt version %s in %s\n",
- QMAKE_VERSION_STR, qVersion(),
+ QMAKE_VERSION_STR, QT_VERSION_STR,
QMakeLibraryInfo::path(QLibraryInfo::LibrariesPath)
.toLatin1()
.constData());
@@ -390,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 {
@@ -465,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;
}
@@ -528,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;
diff --git a/qmake/project.cpp b/qmake/project.cpp
index ab292e0a52..462c8d709a 100644
--- a/qmake/project.cpp
+++ b/qmake/project.cpp
@@ -138,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/property.cpp b/qmake/property.cpp
index 6ac1321355..32b6729c13 100644
--- a/qmake/property.cpp
+++ b/qmake/property.cpp
@@ -5,7 +5,7 @@
#include <qdir.h>
#include <qsettings.h>
-#include <qlibraryinfo.h>
+#include <qtversion.h>
#include <qmakelibraryinfo.h>
#include <qstringlist.h>
#include <stdio.h>
@@ -76,7 +76,9 @@ void QMakeProperty::reload()
#ifdef QMAKE_VERSION_STR
m_values["QMAKE_VERSION"] = ProString(QMAKE_VERSION_STR);
#endif
- m_values["QT_VERSION"] = ProString(qVersion());
+#ifdef QT_VERSION_STR
+ m_values["QT_VERSION"] = ProString(QT_VERSION_STR);
+#endif
}
QMakeProperty::~QMakeProperty()
@@ -142,8 +144,10 @@ int QMakeProperty::queryProperty(const QStringList &optionProperties,
#ifdef QMAKE_VERSION_STR
specialProps.append("QMAKE_VERSION");
#endif
+#ifdef QT_VERSION_STR
specialProps.append("QT_VERSION");
- for (const QString &prop : qAsConst(specialProps)) {
+#endif
+ 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/propertyprinter.cpp b/qmake/propertyprinter.cpp
index 6ba2f76363..52a790e2c8 100644
--- a/qmake/propertyprinter.cpp
+++ b/qmake/propertyprinter.cpp
@@ -1,16 +1,20 @@
// Copyright (C) 2021 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+// 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;
}
@@ -22,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 ba7a1d92df..90fa3a4274 100644
--- a/qmake/propertyprinter.h
+++ b/qmake/propertyprinter.h
@@ -1,5 +1,5 @@
// Copyright (C) 2021 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+// 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/qmakelibraryinfo.cpp b/qmake/qmakelibraryinfo.cpp
index 4a68eead8f..a840036613 100644
--- a/qmake/qmakelibraryinfo.cpp
+++ b/qmake/qmakelibraryinfo.cpp
@@ -1,6 +1,6 @@
// Copyright (C) 2021 The Qt Company Ltd.
// Copyright (C) 2016 Intel Corporation.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "qmakelibraryinfo.h"
@@ -76,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 {
@@ -217,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++;
@@ -231,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 7c303c43b8..c3240efd15 100644
--- a/qmake/qmakelibraryinfo.h
+++ b/qmake/qmakelibraryinfo.h
@@ -1,5 +1,5 @@
// Copyright (C) 2021 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef QMAKELIBRARYINFO_H
#define QMAKELIBRARYINFO_H