When adding the static dependencies for a module, they should be
added to the debug|release configuration as appropriate, otherwise
it ends up adding the debug version of the libraries to the release
configuration as well as the release version of the libraries.
Implementation wise, that means we have to use generator expressions
of the form $<$<CONFIG:Configuration>:${dependencies}>, because
INTERFACE_LINK_LIBRARIES does not have a
INTERFACE_LINK_LIBRARIES_<CONFIG> equivalent that can be set per
configuration.
Note that the condition part of the generator expression can not
explicitly check for Debug or for Release, because a user can
configure their application without specifying CMAKE_BUILD_TYPE,
which means that both Debug and Relase conditions would fail.
So the actual condition has to be isDebug or isNotDebug.
The same approach is used for INTERFACE_LINK_OPTIONS.
For debug_and_release builds we use the isDebug and isNotDebug
conditions for the generator expressions.
For singular builds (only release or only debug), we set the
generator expression condition to "1" aka always true.
This means that the Qt libraries and link options will always be used
regardless of the configuration with which the CMake application
is configured with.
Fixes: QTBUG-76337
Task-number: QTBUG-38913
Change-Id: I5369d8ba083359a4a92253dbd1dabe9d1efa34db
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
The absolute paths of certain static dependencies can have spaces in
them. The _qt5_$${CMAKE_MODULE_NAME}_process_prl_file fails to handle
this, and simply replaces all spaces with semicolons, which obviously
breaks the list of dependencies, and a consuming application fails to
link with a message like:
LINK : fatal error LNK1181: cannot open input file 'C:\Program.obj'
This change partially restores the functionality that was added in
102e1822ff specifically the part
that changes qmake to export an additional variable
QMAKE_PRL_LIBS_FOR_CMAKE. This variable has the same content as
QMAKE_PRL_LIBS except it uses a semicolon as a separator, so that
CMake can correctly parse the separate lib entries.
This is much cleaner than trying to parse the original QMAKE_PRL_LIBS
variable with a complicated regular expression.
Amends eda28621f6.
Task-number: QTBUG-38913
Change-Id: I1d18fb779606505bc92320d8ce13232c7022e212
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
The paths to the libraries and prl files should have the "_debug"
suffix for the debug configuration. This prefix is added to the TARGET
when by qt_module.prf when doing a debug build, but not during a
debug_and_release build.
Make sure to strip the _debug suffix if it's there, and re-add it later
always, to be consistent in both debug_and_release builds and in
debug builds.
Amends a12b6e7bf6.
Task-number: QTBUG-38913
Task-number: QTBUG-75520
Change-Id: I29e88f2b991e2be06b23652d64edc768fa35a5ae
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Like in Qt code itself we should use forward slashes consistently.
This enables the vulkan test to run on Linux for MinGW
cross-compilation.
Task-number: QTBUG-76660
Change-Id: Ifc6dec11bac3c3769d5d06e49da529f66f7b5843
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
The make executable that comes with Android's NDK tries to execute the
shell-builtin "move" as a stand-alone executable unless you trick it
to execute "move" through the shell by surrounding one argument with
double quotes or such.
Force the execution of "move" through shell by altering QMAKE_MOVE for
Android on Windows.
Change-Id: I5b1490ad0606960dbd06a4cafb0b0b983e265159
Fixes: QTBUG-35713
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
We must use the same two-level replacements like for .prl files.
This amends commit d5071a40.
Change-Id: Iea065d01dee61cf2d1ff78640d045c3c76db9ac8
Fixes: QTBUG-76625
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Static libraries may get installed and used by other builds, which may
be done with a different version or build of the compiler. So this
commit introduces two new flags:
- no-static-ltcg: disables LTCG completely for static libraries
- fat-static-lto: forces static libraries to produce fat LTO objects
fat-static-lto is useful for Linux distributions, since installed static
libraries should not carry LTO information, but that information is
useful during Qt's own build. This feature should be used alongside some
compiler-specific method of removing the LTO information from the
static libraries prior to installation, so only the regular part
remains.
For current GCC versions, this command suffices:
strip -R '.gnu.lto*' -R '.gnu.debuglto*' libname.a
Otherwise, distributions can use "no-static-ltcg" to disable it
completely.
Change-Id: I495bc19409f348069f5bfffd155237ade9f4b42f
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Normal sources are built using $(CXX), which is defined in the makefile,
but can be overridden. We should do the same lazy evaluation of the
compiler for headers.
Change-Id: Ic548786bd18ed8fb7eb0b58a527615ab19000323
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
If the QMAKE_CXXFLAGS already had -ffat-lto-objects, the *= wouldn't add
it it again, after our "-flto -fno-fat-lto-objects", which meant the
last one would stand.
Change-Id: Ic9cfa6256b5045caa6e6fffd15a7f6cda7aaa837
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Done to fix broken CMake WebAssembly support, where CMAKE_CXX_STANDARD_LIBRARIES
appear to be empty. The regression was introduced by
ba4fdd99ff.
This fixes the following CMake error on find_package(Qt ...):
string sub-command REGEX, mode REPLACE needs at least 6 arguments total to command.
Fixes: QTBUG-73475
Fixes: QTBUG-76244
Change-Id: Ieebe8cd1d49bb302dc37d8f118cc0b9376d6cdd7
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
The regular expression with the alternative is not portable.
Use a separate QMAKE_PRL_INSTALL_REPLACE item.
This amends commit f00de33.
Fixes: QTBUG-75950
Change-Id: I78e172053f8b05be7d595a1c9e1695ea658b0547
Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
In the case of building a Qt module repository against an installed
qtbase the .prl files contain absolute paths to Qt dependencies e.g.
'/install-prefix/lib/libQt5Core.so'.
Those must be replaced with $$[QT_INSTALL_PREFIX]. The .prl
replacement code however only takes $$MODULE_BASE_OUTDIR/lib into
account.
Fixes: QTBUG-75804
Change-Id: I5ea5623ca7396b672fded3f1b9434b9ad5ed12ec
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Mips archs were removed from Android NDK long time ago.
Change-Id: Icf64a1e2cfbe3fe7307c7898b14fd199d9eeaad3
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Do not store this variable locally, because
a) it might change if the SDK location changes
b) does not play well with Qt installer packages which would provide the
include path of the build machine.
To achieve this we introduce the (usual) magic value - for
QMAKE_EXPORT_INCDIR_VULKAN to denote "do not export this value".
Fixes: QTBUG-73796
Change-Id: Ied26ee12cbcdf7f5f6e1caef5d29dadf6309c5d6
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
QMAKE_PRL_LIBS contains absolute paths to libraries, e.g. libqtpcre2.a.
On "make install" the libdir is replaced with the installation target
libdir. If the libdir is in QMAKE_DEFAULT_LIBDIRS (e.g. /usr) then the
replacement was empty. That worked fine for include paths but not for
paths referencing files in that libdir:
/my/build/lib/qtbase/lib/libqtpcre2.a would become /libqtpcre2.a.
Add another replacement that takes care of file paths and inserts
$$[QT_INSTALL_LIBS].
Fixes: QTBUG-75460
Change-Id: I4e84478a50c24d4143ad5695493cad2992735cf2
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Samuli Piippo <samuli.piippo@qt.io>
Implicit copy constructors or methods are considered deprecated for
classes that has one of the two or a destructor.
The warning is enabled with -Wextra in gcc 9
Change-Id: Ic9be654f2a142fb186a4d5a7d6b4f7d6f4e611d8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Do not call find_library() on libs that are part of CMAKE_CXX_STANDARD_LIBRARIES:
At CMake call time they might not be found.
Fixes: QTBUG-73475
Change-Id: I350b3280744883e82d83c46e70f6a7cfc8aeed2e
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
The sysrootification of QMAKE_INCDIR_OPENGL on macOS must happen only
once. Commit 49ef3773 addressed this but stored the sysrootified
QMAKE_INCDIR_OPENGL in qt_lib_gui_private.pri. For installer packages,
these paths are the paths of the build machine and most likely wrong
on the user's machine.
This reverts commit 4949ef377349ba4dae840c2d5caa36e2d516707baa and
restores the sysrootification in sdk.prf. The original include paths
are assigned to QMAKE_EXPORT_INCDIR_OPENGL and stored as
QMAKE_INCDIR_OPENGL in qt_lib_gui_private.pri.
Fixes: QTBUG-75374
Task-number: QTBUG-73736
Change-Id: I4c0f65866d60660c632363dba3adc7ea2e344bfc
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
When building in a unix style build system (i.e. msys), QMAKE_DIRLIST_SEP
is a colon, not a semicolon. Thus, always split the incoming string
(after the fixup regex) using semicolons on windows.
This matches the code for gcc, further up, which does:
equals(QMAKE_HOST.os, Windows): \
paths = $$split(line, ;)
else: \
paths = $$split(line, $$QMAKE_DIRLIST_SEP)
Change-Id: I6a0175f9d14ae9ca188553483b7868f0549c784a
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
For gcc's -I and -L arguments a = prefix is replaced by the sysroot.
Since we're resolving include paths and library paths, we have to
support this feature.
For example, the linux-rasp-pi3-g++ makes use of this and is broken
without this patch.
Change-Id: Ie39e63322bd35e2a93aa8e55d52260164b8c6a6b
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Injected headers were made relative to MODULE_BASE_OUTDIR by syncqt
and made absolute by resolving against REAL_MODULE_BASE_OUTDIR.
This breaks for modules that reside outside the original Qt source
tree (if the directory depth doesn't coincidentally match).
Now, we resolve injected headers against build_basedir, which is
REAL_MODULE_BASE_OUTDIR. To emphasize the equivalence of
REAL_MODULE_BASE_OUTDIR and syncqt's build_basedir, use the former for
syncqt's -output argument.
This commit amends 2aa779e8.
Fixes: QTBUG-70587
Change-Id: I2935d87d7ee681fa4aa795a270b94ab7a43abe59
Reviewed-by: Dominik Holland <dominik.holland@pelagicore.com>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Makes it possible to build user projects and Qt with C++2a. It is not
automatically upgraded to yet though.
Change-Id: I949ce94871ddc53f21b7265a52b9c0e1370456c8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
this avoids the scenario where the linker would pick up the wrong qt
libraries for LIBS_PRIVATE because LIBS added the "wrong" path first.
this is also consistent with configure-supplied dependencies as of
recently.
as a side effect, this also removes pretenses of lsb linker handling, as
it makes no sense after the change and is certainly obsolete anyway.
Fixes: QTBUG-50921
Change-Id: I84398c9143f393c2eefb3c69a31bd9f633669924
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This is a follow-up to f5850cb0da, which
did not take into account some special-casing for macOS framework build,
thus causing CMake to look for QtFoo.framework instead of Foo.framework.
Change-Id: I261b14e75fde66fb57486bde43fc936f796a6f96
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
The checks whether we have a Qt prefix build were broken for
top-level builds. Non-prefix top-level builds were incorrectly
detected as prefix builds.
For top-level non-prefix builds QT_HOST_DATA/QT_INSTALL_PREFIX becomes
something like "~/my/build/dir/qtbase" but .qmake.cache (and
.qmake.super) is/are created in "~/my/build/dir".
This patch extends the prefix_build check by probing for the existence
of .qmake.super, which only exists for top-level builds. Also, we add
qt_prefix_build_check.prf as central place for determining whether we
have a prefix build to make sure that qt_configure.prf and
qt_build_config.prf use the same logic.
Fixes: QTBUG-76185
Change-Id: I2b76fe26013496aaf2dac96ea711b06a69550a29
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Those modules are TEMPLATE=aux, so they weren't triggering the file creation
here.
To make this work properly we have to:
- check for TEMPLATE aux in the right places
- add a dummy target to INSTALLS to actually trigger the creation
- initialize PRL_TARGET for aux templates
Fixes: QTBUG-75901
Started-by: Thiago Macieira <thiago.macieira@intel.com>
Change-Id: Idce141629dd34287808bfffd159f92ac28c6c8b1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The CMake configure_file command is commonly used copy & modify template files
during the build process. One limitation, thought, is that configure_file
expect the variables to be replaced to be encoded using either a @APPNAME@ or
${APPNAME} convention.
This commit therefore changes "APPNAME" to "@APPNAME@" in wasm_shell.html to
make the HTML template file compatible with CMake configure_file.
With this commit, it becomes possible to write the following CMake function
that mimics what QMake is already doing:
function(copy_html_js_launch_files target)
set(APPNAME ${target})
configure_file("${_qt5Core_install_prefix}/plugins/platforms/wasm_shell.html"
"${target}.html")
configure_file("${_qt5Core_install_prefix}/plugins/platforms/qtloader.js"
qtloader.js COPYONLY)
endfunction()
Change-Id: Ic38abdc498ba03b8d21f1b9b70aa1d480ae7f362
Reference: https://cmake.org/cmake/help/latest/command/configure_file.html
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Since change c808a6978b plugins.qmltypes and designer/* didn't
get copied anymore for a non-prefixed build. Fix this, and clean up surrounding
code.
Fixes: QTBUG-75682
Change-Id: Ic6de94a5b01dae08929a67cbaedde60d120a4807
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
[ChangeLog][qmake] The CONFIG value c++latest was added to select the
latest C++ standard the currently used toolchain supports.
Task-number: QTBUG-75653
Change-Id: I22ddc9d293109d99e652b7ccb19d7226fca4716d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
CMAKE_QT_STEM already contains the _debug suffix.
Do not add it again.
This amends commit bb8a3dfc.
Fixes: QTBUG-75520
Change-Id: I6c311f0913ea83fcf299a21a0ee1f28c3861371f
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
The regular expression with the alternative is not portable.
Use a separate QMAKE_PRL_INSTALL_REPLACE item.
This amends commit f00de33.
(cherry picked from commit 015d7f16cb)
Fixes: QTBUG-75950
Change-Id: I78e172053f8b05be7d595a1c9e1695ea658b0547
Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
In the case of building a Qt module repository against an installed
qtbase the .prl files contain absolute paths to Qt dependencies e.g.
'/install-prefix/lib/libQt5Core.so'.
Those must be replaced with $$[QT_INSTALL_PREFIX]. The .prl
replacement code however only takes $$MODULE_BASE_OUTDIR/lib into
account.
(cherry picked from commit f00de3322e)
Fixes: QTBUG-75804
Change-Id: Ibf0f90a860d5089f416f903c1d18483d3dcc2ee6
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Do remove quotes around libraries before trying to parse them.
This patch is a follow-up to eda28621f6, and fixes
an issue on Windows where e.g. Qt5AxServer.prl contains entries
like
"-lole32"
Fixes: QTBUG-73475
Change-Id: I3d1353de618328a0d44bacd4dbd6aba8fc66b1b7
Reviewed-by: Kyle Edwards <kyle.edwards@kitware.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>