Commit Graph

27 Commits

Author SHA1 Message Date
Stephen Kelly
77a03ebd8d Expand the 'existing target guard' in generated CMake files.
This way the target will be created and have its properties
populated only one time.

I tried wrapping the whole file in an 'include guard', but that
broke the unit test in tests/auto/cmake/pass1 (and
the qt5_use_module function), because the function causes the
variables in the Config file to not exist outside of the
scope (eg for include directories), and yet, Qt5${Module}_FOUND is
still true even when the find_package was previously called in a
function, so it is not found and processed again.

The change in Qt5CoreConfigExtras.cmake does not need to be guarded
as it is only ever included from Qt5CoreConfig.

Change-Id: Iaa016563db5eb61294360ac9e003c9c923393d8c
Reviewed-by: Brad King <brad.king@kitware.com>
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
2012-06-07 19:08:34 +02:00
Stephen Kelly
a49a92bd9d Properly quote all variables which are paths.
This is required if Qt is installed into a directory with spaces.

Change-Id: I1d6874265558d712ac98a3aef670c2934a632ab1
Reviewed-by: Clinton Stimpson <clinton@elemtech.com>
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
2012-05-16 12:03:54 +02:00
Stephen Kelly
f16a77d783 Use IF(NOT TARGET ...) before creating imported targets.
Initially we didn't do this because someone could accidentally create
another target of a conflicting name, and used a variable to store whether we
have created the target already or not.

That wasn't adequeate to deal with finding the package in a scope
like a function, so we used a directory property. However, the directory
property is not valid in the same scopes as the defined target. For
example, finding a Qt module in both a directory and a subdirectory causes
a conflict.

As it is already unlikely that a target would be accidentally created with
a name like Qt5::Core, we should simply use the IF(TARGET) form.

Change-Id: If64f25d45f51edcd1edb0d4bfb5ed3bb2479bd27
Reviewed-by: David Faure <faure@kde.org>
2012-05-15 23:03:23 +02:00
Stephen Kelly
2b735ac8e6 Use directory property instead of variable to determine target existance.
This is more resilient to calling find_package in a scope such
as a function.

Change-Id: I17e69a416f4aed3102fa6195d239bcf4ce0b306b
Reviewed-by: Alexander Neundorf <neundorf@kde.org>
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
2012-05-14 04:35:08 +02:00
Stephen Kelly
dd38ad600f Only find dependencies from the same Qt installation.
Add a PATH to search for dependencies in the current prefix, and
disable other CMake searching logic with NO_DEFAULT_PATH.

A Qt installation must all be installed to the same prefix currently.
If that constraint is ever relaxed, we can turn this into a hint instead.

Change-Id: I633cafb7e546dbd102ac0b2ed18db260d26adc51
Reviewed-by: Alexander Neundorf <neundorf@kde.org>
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
2012-05-13 18:49:10 +02:00
Stephen Kelly
4e8c20e97e Add underscore to internal implementation detail variables.
Change-Id: I4c70ed2808396931fff986fbfad5940dd39e74f6
Reviewed-by: Alexander Neundorf <neundorf@kde.org>
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
2012-05-10 22:46:55 +02:00
Stephen Kelly
bced700e88 Include the VERSION_STRING in CMake config files.
Change-Id: I9f0e9316241b4cb615350876b11ee263f7efd3bf
Reviewed-by: Alexander Neundorf <neundorf@kde.org>
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
2012-05-10 22:45:54 +02:00
Stephen Kelly
27ca259fb6 Don't attempt to ask cmake to find the glib dependencies.
Those components are not known to FindGTK2.cmake.

Change-Id: I4a7fe35d7d118168c24285f3ea8f57822b2facff
Reviewed-by: Alexander Neundorf <neundorf@kde.org>
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
2012-05-08 06:59:19 +02:00
Stephen Kelly
e72a425e13 If a dependency was not found, and we were not called with REQUIRED, we are not found.
This only works with CMake 2.8.8, but it is no harm to earlier versions.

Change-Id: I62c220e4b24f951e83c23eb57d5f833de4d181c5
Reviewed-by: Alexander Neundorf <neundorf@kde.org>
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
2012-04-29 20:28:00 +02:00
Stephen Kelly
05dddb265c Properly quote the dependencies string.
Change-Id: I319b04cdb21860652658ee8d3e577d41a913ed5a
Reviewed-by: Alexander Neundorf <neundorf@kde.org>
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
2012-04-29 20:27:39 +02:00
Stephen Kelly
6e8d306ca7 Make sure different modules do not overwrite each others dependencies.
Change-Id: I30ca05d3c692a707cfe829ad5fee099549bab540
Reviewed-by: Alexander Neundorf <neundorf@kde.org>
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
2012-04-29 14:05:39 +02:00
Stephen Kelly
7fc8edf069 Forward the REQUIRED and QUIET arguments when finding dependencies.
Change-Id: I5d7c26f12a296ac3527575149978b18c5e9a4a67
Reviewed-by: Alexander Neundorf <neundorf@kde.org>
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
2012-04-29 14:05:39 +02:00
Stephen Kelly
f524470a95 Overwrite the LIB_DEPENDENCIES of modules.
This way if a module is found more than once, the list does not grow
duplicates.

Change-Id: I08e3e2a83453f45a49fe79e803a4b50d115709a3
Reviewed-by: Alexander Neundorf <neundorf@kde.org>
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
2012-03-31 01:49:26 +02:00
Stephen Kelly
e96a7e0115 Ensure that the variable for the installation prefix is unique.
Using the same variable for multiple config files can lead to
conflicts.

Change-Id: Ie6a22618c4c2e64567874e5c7e8b278e067fedae
Reviewed-by: Alexander Neundorf <neundorf@kde.org>
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
2012-03-31 01:49:26 +02:00
Stephen Kelly
4a6bf9d941 Prefix the variables for debug and release types properly.
Change-Id: I346992effa997f60a4fd20055f0af81d6a084095
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
2012-03-28 00:51:32 +02:00
Stephen Kelly
c01ef19e77 List the dependencies of Qt when creating static libraries.
Change-Id: Ib6787f982ff962cfdf3d8a0a26989489619a57b0
Reviewed-by: Clinton Stimpson <clinton@elemtech.com>
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
2012-03-05 11:36:36 +01:00
Stephen Kelly
018e78575c Make the CMake files work with directory overrides.
This allows us to create correct CMake config files when Qt is
configured with directories outside of the prefix (which Qt allows),
and also allows us to use correct values when a 'longer' relative
lib directory is used such as lib/x86_64-linux-gnu.

Change-Id: I6f88255a23752dc5b84cb20ce13fdeeee9d5ad51
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
Reviewed-by: Alexander Neundorf <neundorf@kde.org>
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
2012-02-28 21:07:16 +01:00
Stephen Kelly
4d0d49a92c Use QMAKE_SUBSTITUTIONS conditionals
Instead of generating CMake conditionals.

Change-Id: I3d987cc08666270e618222be9292558e73bc961e
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
2012-02-22 19:25:06 +01:00
Stephen Kelly
361cd9f9b2 Give the compile flags an EXECUTABLE_ prefix.
The fPIE flag should only be used with executables.

Change-Id: If799ae4a7fe2492af3aac67651659a52d365024a
Reviewed-by: Alexander Neundorf <neundorf@kde.org>
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
2012-02-21 22:31:00 +01:00
Stephen Kelly
008a1573af Make modules find their own dependencies.
Change-Id: I4a7b96d33417a15d79f3932ced91bee58915c83f
Reviewed-by: Alexander Neundorf <neundorf@kde.org>
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
2012-01-11 01:11:47 +01:00
Stephen Kelly
34ebd0397e Fix cmake files for static builds.
Change-Id: I3864017df6fc0daeb31b389c8883401d344730bf
Reviewed-by: Alexander Neundorf <neundorf@kde.org>
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
2011-12-23 17:35:33 +01:00
Stephen Kelly
5fb4bf8987 Include the extras files after defining the target.
Allows the extras file to contain references to the target.

Change-Id: I47332c4efcb7ba0132509a41fa3040531cd1c81f
Reviewed-by: Alexander Neundorf <neundorf@kde.org>
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
2011-12-19 10:41:50 +01:00
Stephen Kelly
4d98b83c17 Use plural form for CMake variables.
Change-Id: Idc0cd360e09046a5746c9f7366c7fd4b982058fe
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
2011-12-06 11:57:11 +01:00
Stephen Kelly
3b3531285d Remove CMake variables which are not needed in Config files.
Change-Id: I8f6795f1d40983af0478270f33ab1c06abe67133
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
2011-12-06 11:57:11 +01:00
Stephen Kelly
353c404f04 Quote the path in CMake so that spaces in paths work.
Change-Id: Ie73a4b242ab0bf90e6f292be9a7b7913ae4273a5
Reviewed-by: Clinton Stimpson <clinton@elemtech.com>
Reviewed-by: Richard J. Moore <rich@kde.org>
2011-12-03 23:14:33 +01:00
Stephen Kelly
e0593c828b Make the Qt5 part of the target name namespace style.
As it was in Qt4 and discussed on the cmake list.

Change-Id: Ide77c2525a261a5d658d7cb661010a67d3386341
Reviewed-by: Clinton Stimpson <clinton@elemtech.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
2011-12-02 14:17:40 +01:00
Stephen Kelly
a482487b9f Install CMake config files from Qt.
This includes a BSD licenced file Qt5CoreMacros.cmake which is
adapted from Qt4Macros.cmake in the CMake source tree.

Change-Id: I54326b808795535490a0489659b351a8da72cdbb
Reviewed-by: Clinton Stimpson <clinton@elemtech.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
2011-11-29 17:08:39 +01:00