Commit Graph

105 Commits

Author SHA1 Message Date
Alexandru Croitor
3122e7c01a Fix qt_build_repo to be more robust
Check for the existence of CMakeLists.txt files before trying
to call add_subdirectory on examples, tests and src folders.

Change-Id: I7be76de5f7520c1dd181c610fd1dc2200ac74672
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-05-28 17:02:38 +00:00
Alexandru Croitor
c7fd10a022 Allow building the tests directory as a standalone CMake project
At the moment, Coin builds tests as a separate qmake invocation
against an installed Qt. We need to support the same with CMake.

Change the tests subdirectory to be a standalone CMake project when
CMake does not detect an existing QtTest target while processing the
subdirectory. If the target exists, it means we are building the whole
repo, if the target does not exist, we need to call find_package
to find the installed Qt.

Refactor and move around a few things to make standalone tests build
successfully:
- add a new macro to set up paths to find QtSetup
- add a new macro to find all macOS frameworks
- add a new macro to set up building tests
- add a new macro that actually builds the tests
- export the INSTALL_CMAKE_NAMESPACE value into the BuildInternals
  Config file
- export the CMAKE_BUILD_TYPE value, because a test project doesn't
  have a .git subdir and thus defaults to be built in Release
  mode, even though qtbase might have been built in Debug, so to
  avoid the mixing, the propagate the build type
- stop overriding INSTALL_CMAKE_NAMESPACE and
  QT_CMAKE_EXPORT_NAMESPACE inside QtSetup if they are set, because
  the tests project doesn't specify a major version, and if we
  override the values, the moc / uic targets don't get the correct
  major version prefix and configuration fails

Change-Id: Ibdb03687302567fe325a15f6d1cb922c76240675
Fixes: QTBUG-75090
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-05-22 11:12:54 +00:00
Simon Hausmann
d61ca95fc0 Simplify top-level CMakeLists.txt for modules
Implement some aspects of qt_parts.prf to simplify the top-level
CMakeLists.txt for repositories that follow the common qt structure
(src, tools, tests, examples).

Change-Id: Ia35f4e9207e92c1cf0406353561b0cc52dcb0e59
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-21 08:05:44 +00:00
Alexandru Croitor
a859cb508c Automatically install repo specific cmake find modules
Some qt modules need to find 3rd party packages for which there
are no Config files. We need to write custom CMake Find modules to
find those packages. These find modules need to be installed so that
they are used when a user consumes the Qt packages.

Automatically include and install these find modules if they exist,
as part of qt_build_repo_end().

Change-Id: I14aad35ed2999cac8bdda65ca4aeaf74d04fdb71
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Reviewed-by: Liang Qi <liang.qi@qt.io>
2019-05-20 13:48:16 +00:00
Alexandru Croitor
9542e78525 Use the qt_build_repo() macros for building qtbase as well
To implement this, create a new Qt5BuildInternals package.

All child Qt modules like qtsvg should use
find_package(Qt5BuildInternals) or
find_package(Qt5 COMPONENTS BuildInternals) in the their
top level CMakeLists.txt.
This will make the qt_build_repo() macros available.

For qtbase we slightly cheat, and specify a CMAKE_PREFIX_PATH
pointing to the source folder that contains the BuildInternals
package.

For the other modules we actually use a configured and installed
package Config file.

This change moves variables that used to be written into the
QtCore Config file into the BuildInternals package. This way
things that are relevant only for building additional Qt modules
does not pollute the QtCore package.

Task-number: QTBUG-75580
Change-Id: I5479adff2f7903c9c2862d28c05c7f485ce3e4eb
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-05-15 17:33:51 +00:00