Commit Graph

5 Commits

Author SHA1 Message Date
Joerg Bornemann
bd98ba0d17 CMake: Do not discard empty QMAKE_LIBS_FOO entries
Consider a qmake lib 'foo' that doesn't have entries in
QMAKE_LIBS_FOO. Then we must not discard this entry in the generated
module pri file, because otherwise any attempt to QMAKE_USE 'foo' will
fail with the error message "Library 'foo' is not defined.".

Pick-to: 6.0
Task-number: QTBUG-88951
Change-Id: Ibed283857f5f66b1b79459fe7b7cf06c7ce0691d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-11-30 23:17:52 +01:00
Alexandru Croitor
9c0f448f5a CMake: Fix generated content of prl files (again)
Apply the same kind of transformations to the contents of the prl
files as we do for pri files. Mainly, transform system library paths
that are absolute, into link flags to make them relocatable across
systems.

Also change the Qt frameworks to be linked via the -framework flags
instead of via absolute paths.

Implementation notes

Move the common required functions for both QtFinishPrlFile and
QtGenerateLibPri into a common QtGenerateLibHelpers.cmake file.

Make sure it's listed as a dependency for the custom commands.
Also make sure to pass the necessary input values like possible
library prefixes and suffixes, as well as the link flag.

Task-number: QTBUG-85240
Task-number: QTBUG-85801
Change-Id: I36f24207f92a1d2ed3ed2d81bb96e4e62d927b6e
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2020-07-31 14:29:45 +02:00
Alexandru Croitor
868c7016e0 CMake: Use correct framework link flags in scripts and .pri files
target_link_libraries expects a quoted string like
"-framework CoreFoundation" when linking frameworks and not 2
different arguments like "-framework" "CoreFoundation".

Fix that in the FindWrapOpenGL and FindGLESv2 find modules.

Make sure to not quote the framework link flags when generating
.pri files even if there are spaces, otherwise building apps
with qmake fails.

Amends 7fcc9cf055
Amends 2ed63e587e
Amends 55a15a1c1b
Amends 2a767ab4bb

Task-number: QTBUG-85240
Change-Id: I66ba36760ad704d65e712072a528d9e25c336dfa
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-07-01 10:03:38 +02:00
Alexandru Croitor
63f09a94db CMake: Transform absolute library paths into link flags in .pri files
Before this change, the qt_lib_foo_private .pri files contained
absolute paths to libraries, e.g.
  /usr/lib/x86_64-linux-gnu/libcups.so

Whereas the qmake build instead embeds link flags like -lcups.

Detect absolute library file paths, and transform them into link
flags. This should make the .pri files relocatable.

Fix the add_custom_commands to have the scripts as dependencies.
Make sure to pass the suffix, prefix and other options to the
qconfig.pri generation command as well.

Also reverse the order of the link flags, to mirror the order
that qmake generates for .pri files.

Task-number: QTBUG-84781
Task-number: QTBUG-85240
Change-Id: I7bc3b234d9c86c785b169b11f3042450aa225c1f
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-06-29 12:23:05 +02:00
Joerg Bornemann
2a767ab4bb CMake: Fix libraries in qt_lib_XXX_private.pri files for NMC
qmake_use.prf understands the _DEBUG and _RELEASE suffixes for
QMAKE_LIBS_XXX entries. The CMake configuration "Debug" is considered
for the _DEBUG entries, "Release" and "RelWithDebInfo" for _RELEASE.

The qt_lib_XXX_private.pri files are now generated in multiple steps:
1. The QT_LIBS_XXX information is generated per $<CONFIG> and written to
   .cmake files.
2. A preliminary qt_lib_XXX_private.pri file is generated, containing
   only configuration-independent data.
3. A custom command runs the QtGenerateLibPri.cmake script that combines
   the files from step 1 and 2 into the final qt_lib_XXX_private.pri
   file.

The same is done for mkspecs/qmodule.pri.

To be able to trigger custom commands from header modules, which are
interface libraries, we introduce one XXX_timestamp ALL target per
header module that creates a timestamp file. To that XXX_timestamp
target we add the pri file generation target as dependency.

Fixes: QTBUG-84348
Change-Id: I610f279e37feeb7eceb9ef20b3ddfecff8cfbf81
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-06-09 21:04:26 +02:00