Commit Graph

6 Commits

Author SHA1 Message Date
Lucie Gérard
32df595275 Change the license of all CMakeLists.txt and *.cmake files to BSD
Task-number: QTBUG-105718
Change-Id: I5d3ef70a31235868b9be6cb479b7621bf2a8ba39
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-08-23 23:58:42 +02:00
Lucie Gérard
fb1b20eab3 Add license headers to cmake files
CMakeLists.txt and .cmake files of significant size
(more than 2 lines according to our check in tst_license.pl)
now have the copyright and license header.

Existing copyright statements remain intact

Task-number: QTBUG-88621
Change-Id: I3b98cdc55ead806ec81ce09af9271f9b95af97fa
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-08-03 17:14:55 +02:00
Li Xinwei
2915921ad2 Fix generated pri and prl files
Quote the paths after "-L".

Get MSVC’s implicit link directories from $ENV{LIB}.

Fix some issues cause by Inconsistent case.

Amends 2c49f85380

Fixes: QTBUG-95198
Pick-to: 6.2 6.1
Change-Id: Ie82f10b088e2764396377726340509f24a4ae8e7
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-07-17 02:42:13 +08:00
Li Xinwei
2c49f85380 CMake: Fix generated prl and pri files for MSVC
In MSVC static build, if we build Qt with 3rdparty library (e.g. zstd),
cmake will add"zstd" (without "-l" prefix) to Qt6Core.prl. Then we
use this Qt to build a qmake project, compilation will fail due to
missing zstd.obj. Without "-l" prefix, qmake will treat "zstd" as an
object file instead of a library.

Library names in qt_module.pri and qt_lib_*_private.pri are also
missing "-l" prefix.

This is because on most compilers, CMAKE_LINK_LIBRARY_FLAG equals
"-l". But on MSVC, it is an empty string. So we should pass
"-DLINK_LIBRARY_FLAG=-l" for MSVC.

Also add "-L/path/to/library" if the library path is not in default
linker search directories. This will write un-relocatable paths to prl
files only when using 3rdparty libraries to build Qt statically. Usually
it's not a problem.

In addition, CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES is also empty on
MSVC. So The third argument of "$<FILTER>" is empty, it is an invalid
generator expression. This means no include dir will be written to
qt_module.pri and qt_lib_*_private.pri on MSVC. So only use "$<FILTER>"
when CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES is not empty.

Pick-to: 6.1
Change-Id: Ib66f95dc09cf920363a4b9338fb97747dd2f8ab7
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-06-02 13:32:06 +08:00
Alexandru Croitor
bae96f1792 CMake: Fix generation of prl files for non-qtbase modules
Previously we determined if a library represented by an absolute path
is a Qt module by checking if it's located in the build dir of the
current repo.

That is not sufficient for non-qtbase prefix builds, where
a Qt module might link against both a module in the current
build dir and in the prefix dir.

Detect such cases, and rewrite the absolute paths to relocatable paths
(either framework flags or paths starting with $$[QT_INSTALL_LIBS].

This should fix building examples with qmake that use QtQuick.

Fixes: QTBUG-87840
Change-Id: Icaf8f1a7c66292c80662fd0d5771a5a1628a9899
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-10-29 12:11:53 +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