Commit Graph

61 Commits

Author SHA1 Message Date
Kevin Funk
988162eaf8 cmake: Start to use ConfigExtra.cmake files
Enables the use of e.g. QT_NO_DEBUG in compiler flags, -fPIC, passing on of
QT_NAMESPACE, etc. pp.

Dropping a lot of custom code which handled adding imported targets for
the command-line tools (this is all being handled by CMake already).

It needs to be investigated if we need to resurrect
Qt5GuiConfigExtras.cmake.in in one way or the other.

Change-Id: I4fa141b68fddaad4f33e628c59d5d0b3a7b3a096
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-02-12 13:37:08 +00:00
Albert Astals Cid
05aeaed906 Find mtdev and use it
Change-Id: I90db48efaa6a23add770fcf69b46c4f4c84866c1
Reviewed-by: Liang Qi <liang.qi@qt.io>
2019-02-12 13:35:07 +00:00
Jean-Michaël Celerier
bb2ae3e409 cmake: replace unused macro with a proper value
Change-Id: Icc2b5a63fc503aa99bbb0c8ee9ffddc985e0e3da
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-02-12 11:28:08 +00:00
Kevin Funk
4bfd6c010b cmake: Create Qt5 compat targets in config files
For now create targets a la "Qt5::Core" to stay compatible with the
current Qt5 naming scheme. The name is controllable via a CMake option.

Change-Id: If43c058221949b1900c2093f39ccc9d0f38028f1
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-02-12 11:09:03 +00:00
Kevin Funk
b3560a66ae cmake: Set up VERSION/SOVERSION properly
Change-Id: Ic8cddf5ec8182873a6b1e03c76f514284b423322
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-02-12 11:08:28 +00:00
Albert Astals Cid
ac96d08b9d cmake: find gtk3 and build the gtk3 platformtheme
Change-Id: I7db7321a2fd5ea0eda1924f3dece3b1c86d87d10
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-02-11 17:16:28 +00:00
Albert Astals Cid
f18db41f85 cmake: Find tslib and build the tslib plugin if found
Change-Id: I7119ddf473a3ede29bbfef23cffb08a4fcbd5681
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-02-11 17:16:17 +00:00
Kevin Funk
2635ab01d2 cmake: QtFeature: Do not error out when using Qt
... outside of qtbase.git

Change-Id: I1895ef07c881766e2b28839d0422916b6916e10e
Reviewed-by: Jean-Michaël Celerier <jean-michael.celerier@kdab.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-02-11 17:14:01 +00:00
Kevin Funk
c5e2838b64 cmake: Make find_package(Qt5 ...) work properly
Introduce a new cached variable INSTALL_CMAKE_NAMESPACE for defining the
prefix used for CMake config files (c.f. "${PREFIX}Core/${PREFIX}CoreConfig.cmake")

Also make sure to `find_dependency(...)` the required packages inside
the individual CMake config files. I.e. in Qt5WidgetsConfig.cmake,
search for Qt5Core, etc. pp..

Change-Id: Idc027925fe9d5323091c4853803ad5ce44b1afc6
Reviewed-by: Jean-Michaël Celerier <jean-michael.celerier@kdab.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-02-11 17:13:51 +00:00
Kevin Funk
082a7c4655 cmake: Parse SYNCQT.INJECTIONS
Allows to install headers such as QtCore/qtconfig.h,
QtGui/qvulkanfunctions.h, etc.

Change-Id: I93f384cdc8bbee07fab316d7e232aae1d209f33e
Reviewed-by: Jean-Michaël Celerier <jean-michael.celerier@kdab.com>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-02-11 16:51:27 +00:00
Albert Astals Cid
5716bcf6f7 cmake: we need to find for libudev not udev
Change-Id: I36bac8c01d8de2b151c3d4d89607d26ac8add3d2
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-02-11 13:20:45 +00:00
Kevin Funk
99e14037e2 cmake: QtFeature add debugging aid
Persist the target name in the CMake cache description

Change-Id: I124a8b89e5845d12301993b0546c8d5c91b8d8bb
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-02-11 10:53:50 +00:00
Kevin Funk
04ff8b5b6a cmake: Do not rerun try_compile invocations
Change-Id: I5eccf9f810d7ee55a311884bd5cf483f8086bae6
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-02-11 10:53:41 +00:00
Albert Astals Cid
2ce3f440f9 Allow passing libraries to qt_config_compile_test
Fixes cxx11_future and ipc_posix tests

Change-Id: I0f3a7b1a0452724c07198a87c2fc25344e7451eb
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-02-11 09:26:08 +00:00
Albert Astals Cid
b6306cb066 cmake: Only use the doubleconversion cmake config if "valid"
And by "valid" i mean if it returns the double-conversion::double-conversion
target that we are going to use later. Fedora rawhide has a
doubleconversion cmake config file but it doesn't define any target

Change-Id: Ib0360bc9fdf593a14510c9a2d59b47b32bc4b356
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-02-01 12:26:43 +00:00
Tobias Hunger
3e36bcdca0 CMake: Introduce QT_HAS_NAMESPACE
This makes testing for Qt with namespace builds easier in extend_target.

Change-Id: I58ab985a2ed39859fb65d35f8f69065fed2a5c9b
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2019-01-31 13:57:33 +00:00
Tobias Hunger
e7e793555f CMake: Add FindZSTD.cmake and wire it up in configurejson2cmake.py
Zstd is used in the dev branch, so prepare for it.

Change-Id: I130d98e3888a1eb4c7444728fc5088c5dae9d911
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2019-01-31 13:57:24 +00:00
Tobias Hunger
1218d8a9f0 CMake: Use FindGLIB2 from cmake-extra-modules
Use FindGLIB2 from cmake-extra-modules over hand-rolled own version.

Change-Id: I1f8e055bc12dd728c033fd88480690643d90159a
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2019-01-31 13:56:55 +00:00
Tobias Hunger
06e8dd31e9 CMake: Add debugging support for extend_target(...) calls
Enable a flag so that cmake documents which extend_target calls it
acts upon and which ones are skipped.

Change-Id: I1e2d4da47b93d6b5d7b7ec25b7bc6341f38b3dca
Reviewed-by: Albert Astals Cid <albert.astals.cid@kdab.com>
2019-01-31 10:33:52 +00:00
Tobias Hunger
210762ae46 CMake: pro2cmake.py: Pass QMAKE_MOC_OPTIONS on to CMake
Change-Id: I39c1b0aedbffaa29a34253e0c1c4bb4a4dddbe98
Reviewed-by: Albert Astals Cid <albert.astals.cid@kdab.com>
2019-01-31 10:02:40 +00:00
Tobias Hunger
4d4bf61f9f CMake: pro2cmake.py: Convert more settings from .pro-file to CMake
Convert QMAKE_USE, QMAKE_CXX_FLAGS and QMAKE_LFLAGS into CMake.

Change-Id: I53a5b91664b6ab71892d4381c00f8d744d7d7abd
Reviewed-by: Albert Astals Cid <albert.astals.cid@kdab.com>
2019-01-31 10:02:24 +00:00
Albert Astals Cid
e2dc030ac0 cmake: test: Enable the build of qdbusabstractinterface
Since the code wants pinger_interface.h as include
name and the qt_create_qdbusxml2cpp_command function was
using the filename as source for the next filename i introduced
a new option DBUS_ADAPTOR_BASENAME/DBUS_INTERFACE_BASENAME to set the
name of the resulting file

Change-Id: I582d578b68275e4530e91a88631ae43fd1ae06fd
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-01-30 16:15:08 +00:00
Albert Astals Cid
5e339a0f97 cmake: Add trivial FindLibproxy.cmake
And fix link to it

Change-Id: Ie4f29a35a83d19ab83933faf3bcd7d62cffa68b8
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-01-29 15:07:54 +00:00
Tobias Hunger
6a1ee4de07 CMake: Store Qt features in CMake Cache
This is less self-contained than what we have, but significantly speeds
up cmake configure/generate runs.

This patch also warns when a feature is already defined.

Change-Id: I8cab63e208ba98756b47d362a39b462f5ec55e20
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-01-17 16:16:55 +00:00
Tobias Hunger
3ec578020c CMake: QtFeature optimization
Remove some unnecessary sorting, speeding up cmake by about 10s on my machine

Change-Id: Ieafbd16f6dd8cfe6d1af3c739bfe58e8bf724441
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-01-17 08:34:02 +00:00
Tobias Hunger
235769d56b CMake: Error out on mis-use of qt_pull_features_into_current_scope
Make it a bit harder to mis-use qt_pull_features_into_current_scope.

Change-Id: I2a6be28d7c0e6207217cb1908ec22cc757acd01a
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-01-17 08:33:50 +00:00
Tobias Hunger
4f26758978 CMake: Introduce Qt::GlobalConfig to hold the global features
This simplifies the handling of features a bit as it removes the special
code to store two sets of features in Qt::Core.

Change-Id: I536d41cfc76a02af054e3cfbad6bda50b1e9e49a
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-01-17 08:33:27 +00:00
Tobias Hunger
b705021b4e CMake: Check for visibility once
Change-Id: I5c729f4509eed16409df5eb048afb7f60c5ca57c
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-01-16 11:07:23 +00:00
Liang Qi
3552323049 CMake: update README.md
Because AUTOMOC/AUTOUIC/AUTORCC got merged into master.

Change-Id: I0ddfd4443a9892fae1dca54d75b97af4c69ad7ef
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2019-01-16 09:05:11 +00:00
Tobias Hunger
ff693d664b CMake: Remove one unnecessary feature push into parent scope
During qt_feature_begin_module no features are changed, so there is
no need to push features.

Change-Id: Id7ebcfad373caa284e790b7eb0a178eaa72216e5
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2019-01-14 12:27:44 +00:00
Tobias Hunger
e57a94cbd8 CMake: Use AUTOMOC/AUTOUIC/AUTORCC
Change-Id: I0235ca4f227623e5937348b4b010637921dbf154
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2018-12-14 14:04:59 +00:00
Tobias Hunger
07dfa3013c CMake: Get rid of useless underscores in QtFeature.cmake
Change-Id: I87eb55ed2ce01ab136dac3e2a587b43bd3f8a98e
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2018-12-14 14:00:32 +00:00
Tobias Hunger
42d6e5c5fa CMake: Simplify
* Only import features once
* Move Core specific code into its CMakeLists.txt file
* More consistently use target names like "Core" to
  refer to "Qt modules". We tend to require either "Core"
  or "QtCore" in places, which I find confusing.

Change-Id: Id54161bc5468412750cb9eb7eeb15de3812e8a09
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2018-12-14 14:00:21 +00:00
Tobias Hunger
3a8d8344e5 CMake: Merge qt_internal_module_include_dir and qt_internal_module_info
... and fix the fallout of this change. It results in more targets being
passed overall (instead of a strange mix of targets and module names),
so this is a good thing(TM).

Change-Id: I1c4326b80e2c6675356587879ec8471ef7249a50
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2018-12-14 14:00:11 +00:00
Tobias Hunger
ece38e7e18 CMake: Unify creation of target aliases
For Qt6 we want to have Qt6::foo and Qt::foo. Enable that consistently.

Change-Id: I3cf05c4171b13029bf508d307945e8be4687e86b
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
2018-12-14 14:00:02 +00:00
Tobias Hunger
78d34c3a30 CMake: Refactor qt module name related code
Change-Id: Ib14c030ef6d2e988aaaebca354cf1a6881e05e25
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
2018-12-14 11:43:00 +00:00
Tobias Hunger
8d5c9ebf8c Prefer qt_internal_ over _qt_ for internal functions
Change-Id: Idb6f3d8f29890bb4d8f0d1d644c0d1103342946a
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Reviewed-by: Mikhail Svetkin <mikhail.svetkin@qt.io>
2018-12-14 08:44:02 +00:00
Tobias Hunger
c22dcf6ae1 CMake: Unify on variable names without _ in functions
Change-Id: I28883775d8f9bd718de477c03628b291972f4590
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Reviewed-by: Mikhail Svetkin <mikhail.svetkin@qt.io>
2018-12-14 08:37:22 +00:00
Tobias Hunger
a2da0175cd CMake: Do less feature-pushing
Do not try to push features up into the parent scope if none were added.

This avoids a lot of iterations over all defined variables.

Change-Id: Idb9a4c86643c0ca773584a05b3a0590cfab7514d
Reviewed-by: Mikhail Svetkin <mikhail.svetkin@qt.io>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2018-11-22 15:20:59 +00:00
Tobias Hunger
74e9278553 CMake: Simplify registration of known Qt targets
Change-Id: Ibd7b5f628c0a1a3087bdfebb0c35242b42c5e938
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2018-11-22 15:20:42 +00:00
Tobias Hunger
24fe921161 CMake: Add simple test for moc handling and fix the implementation
Add a simple test for moc-file handling and fix the implementation
to make the test pass.

Change-Id: I34e8d65a5e01a6f557d3a3d8cb262fd147ad78e4
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2018-11-22 15:20:17 +00:00
Tobias Hunger
13e1c93e37 CMake: Add test for QRC and make it pass
Add a test for QRC file handling in cmake and fix the qrc file handling
to handle qrc files in subfolders properly.

Change-Id: Iff4224e59e7ee1badacce5fc00dbf68aef69bffe
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2018-11-22 15:19:41 +00:00
Tobias Hunger
f4dc3dcacb CMake: Add test for uic handling
Add a test for uic handling and make it pass.

Change-Id: I7e11f9f1fba0e40c748e3590a0d0cbb72c9ebc28
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2018-11-22 15:19:22 +00:00
Tobias Hunger
c68e5fc59b CMake: Add macro to generate cmake build-only tests
In addition to cmake tests that run cmake, build and then run the
tests of that project, also add a macro for tests that only run
cmake.

Use this new kind of test for the existing tests.

Change-Id: I465600974ed4114e724988b309404ccd3db2e0cb
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2018-11-22 12:45:35 +00:00
Tobias Hunger
bdb5e2a48e CMake: Simplify qt_make_output_file
Simplify qt_make_output_file and add a simple test for it.

Change-Id: I87694291cd877545ade5d9c42d1424d7b3b7b567
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2018-11-22 10:38:04 +00:00
Tobias Hunger
fac800ad1c CMake: Fix cmake test for features
Features are now always defined (to OFF) when they are not emitted.

Adapt the test for that.

Change-Id: Id5f662f07fea15c22027b9b00d1b53a288b4a0dc
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2018-11-22 08:39:15 +00:00
Tobias Hunger
f37ce9ab84 CMake: Add option to run cmake build tests
Use "cmake -DBUILD_CMAKE_TESTING=ON" to enable running cmake build system
tests with ctest.

Change-Id: I0a32e2d1771c9bbb0df013d0d955a9b58b1d4b79
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2018-11-22 08:39:12 +00:00
Tobias Hunger
eb2ece3c59 CMake: Add FindSlog2
Add FindSlog2 and use it in src/corelib/configure.cmake.

Change-Id: I7e6a696a49df568a41ed1224228ab608db2dbb0e
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2018-11-06 15:24:55 +00:00
Tobias Hunger
38f1a10b6f CMake: Improve handling of the different kinds of iconv
Improve conditions/enable/disable conditions for iconv related features.

These are detected a bit different from what qmake does, so adapt to that.

Change-Id: I7b3e4baf05dc324507f370d7f651a62f29e42a98
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2018-11-06 15:24:35 +00:00
Tobias Hunger
e11522726b CMake: Add FindPPS and use it in src/corelib/configure.cmake
Find the PPS library and use the result PPS_FOUND in configure.cmake where
needed.

Change-Id: I08d3ace421278dc0ae5c3128d4234e6bca906c05
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2018-11-06 15:24:17 +00:00