It's unlikely we will ever use pro2cmake at this project stage,
so it doesn't make any sense to keep the 'special case' markers
in the CMake scripts. Remove them and replace with TODO where
needed.
Change-Id: I84290c20679dabbfdec3c5937ce0428fecb3e5a7
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
ICU 50.1 was released May 11th, 2012. Despite of the restriction, all
currently supported operating systems will continue to be supported.
All mismatches described in QTBUG-99715 are fixed in this version.
Restricting to 72.1 (latest version as per January 2023) or 63.1 (2018)
would still exclude e.g. RHEL 9.0, which ships version 56.1.
Task-number: QTBUG-109505
Pick-to: 6.5
Change-Id: Ic5cd7927d6f5fb60a89423c305796a9ed311bfa2
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
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>
Introduce a bunch of helper functions to manipulate compiler
flags and linker flags for the
CMAKE_<LANG>_FLAGS_<CONFIG>
and
CMAKE_<LINK_TYPE>_LINKER_FLAGS_<CONFIG>
CMake variables.
These variables can be assigned and modified either in the cache
or for a specific subdirectory scope, which will apply the flags
only to targets in that scope.
Add qt_internal_add_optimize_full_flags() function which mimics
qmake's CONFIG += optimize_full behavior.
Calling it will force usage of the '-O3' optimization flag on supported
platforms (falling back '-O2' where not supported).
Use the function for the Core and Gui subdirectories, to enable full
optimization for the respective Qt modules as it is done in the qmake
projects.
To ensure that the global qmake-like compiler flags are assigned
eveywhere,
qt_internal_set_up_config_optimizations_like_in_qmake() needs
to be called after Qt global features like optimize_size and
optimize_full are available.
This means that qtbase and its standalone tests need some special
handling in regards to when to call that function.
Task-number: QTBUG-86866
Change-Id: Ic7ac23de0265561cb06a0ba55089b6c0d3347441
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
mkspecs/features/qt.prf adds a dependency on the system threading
library if the Qt Core thread feature is enabled. Because qt.prf is
loaded by any public or internal Qt project, it's essentially a public
dependency for any Qt consumer.
To mimic that in CMake, we check if the thread feature is enabled, and
and set the Threads::Threads library as a dependency of Qt6::Platform,
which is a public target used by all Qt modules and plugins and Qt
consumers.
We also need to create a Qt6Dependencies.cmake file so we
find_package(Threads) every time find_package(Qt6) is called.
For the .prl files to be usable, we have to filter out some
CMake implementation specific directory separator tokens
'CMAKE_DIRECTORY_ID_SEP' aka '::@', which are added because we call
target_link_libraries() with a target created in a different scope
(I think).
As a result of this change, we shouldn't have to hardcode
Threads::Threads in other projects, because it's now a global public
dependency.
Task-number: QTBUG-85801
Task-number: QTBUG-85877
Change-Id: Ib5d662c43b28e63f7da49d3bd77d0ad751220b31
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
In Coin when provisioning for Android, we download and configure
the OpenSSL package, but don't actually build it. This means that
find_package(OpenSSL) can find the headers, but not the library,
and thus the package is marked as not found.
Previously the openssl_headers feature used the result of finding
the OpenSSL package, which led to it being disabled in the above
described Android case.
Introduce 2 new find scripts FindWrapOpenSSL and
FindWrapOpenSSLHeaders. FindWrapOpenSSLHeaders wraps FindOpenSSL,
and checks if the headers were found, regardless of the OpenSSL_FOUND
value, which can be used for implementing the openssl_headers feature.
FindWrapOpenSSL uses FindWrapOpenSSLHeaders, and simply wraps the
OpenSSL target if available.
The find scripts also have to set CMAKE_FIND_ROOT_PATH for Android.
Otherwise when someone passes in an OPENSSL_ROOT_DIR, its value will
always be prepended to the Android sysroot, causing the package not
to be found.
Adjust the mapping in helper.py to use the targets created by these
find scripts. This also replaces the openssl/nolink target.
Adjust the projects and tests to use the new target names.
Adjust the compile tests for dtls and oscp to use the
WrapOpenSSLHeaders target, so that the features can be enabled even
if the library is dlopen-ed (like on Android).
Task-number: QTBUG-83371
Change-Id: I738600e5aafef47a57e1db070be40116ca8ab995
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Previously repo/tests/CMakeLists.txt was a standalone project on which
CMake could be called. This was useful for Coin to be able to build
and package only tests, but was a bit troublesome because that means
having to specify the usual boilerplate like minimum CMake version,
which packages to find in every tests.pro project.
Instead of having a separate standalone project, modify the top level
project and associated CMake code to allow passing a special
QT_BUILD_STANDALONE_TESTS variable, which causes the top level project
to build only tests, and find Qt in the previously installed qt
location.
This also means that when building a repo, we generate a
${repo_name}TestsConfig.cmake file which does find_package on all the
modules that have been built as part of that repo. So that when
standalone tests bare built for that repo, the modules are
automatically found.
qt_set_up_standalone_tests_build() is modified to be a no-op because
it is not needed anymore. Its usage should be removed from all the
other repos, and then removed from qtbase.
Non-adjusted tests/CMakeLists.txt projects in other repositories
should still be buildable with the current code, until they are updated
to the new format.
Adjust the Coin build instructions to build the standalone tests in a
separate directory.
Adjust pro2cmake to generate new structure for the tests/tests.pro
projects.
Adjust the qtbase tests project.
Fixes: QTBUG-79239
Change-Id: Ib4b66bc772d8876cdcbae1e90ce5a5a5234fa675
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
When a _nolink target is exported, instead of getting the original
namespace prefix, it gets the Qt6 prefix
(OpenSSL::OpenSSL_nolink -> Qt6::OpenSSL_nolink).
There is some special case code in Network autotests which tries
to access the former target name, which doesn't exist when building
standalone tests.
Make sure to create a Qt6:: library alias for _nolink targets during a
build (so before the library is exported), and change the Network
autotests project to use this Qt6:: namespaced library, which will
ensure it is found both in a standalone tests build and in a regular
Qt build.
Also make sure to actually call find_package to find the OpenSSL
library when building standalone tests, otherwise configuration will
fail.
Change-Id: I3da5b958e72e745a50380f8ab1644459a7c6b005
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This fixes building of tests, which are currently all failing in
auto/corelib/time/qtimezone.
Change-Id: I6183217d51b5636651da9026f71353cdde1e2444
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This changes many different CMake places to mention Qt6 instead of
Qt5.
Note that some old qt5 cmake config files in corelib are probably not
needed anymore, but I still renamed and kept them for now.
Change-Id: Ie69e81540386a5af153f76c0242e18d48211bec4
We introduced WrapOpenGL to link against either desktop GL or GLESv2
depending on the GL feature in QtGui. This works "fine", with two
caveats:
(1) find_package(WrapOpenGL) must be called after
find_package(Qt5Gui) in order for the feature check in
FindWrapOpenGL.cmake to work. That's error prone.
(2) More and more places are popping up, in particular examples,
where GL linkage is required due to inline functions in Qt that
forward to GL functions - such as on Android.
This in particular explains the qmake behavior of making the GL
linkage (desktop _or_ GLES) a public dependency of QtGui, so only
Gui linkage is required.
Those two aspects combined are the nail in the coffin of FindWrapOpenGL
and it would seem much easier to simply make the Desktop GL vs. GLES
decision once in Gui's CMakeLists.txt and let Qt5GuiDependencies.cmake
propagate this well. This allows us to get rid of plenty of special
cases as well.
Change-Id: I3a7e8af49537ce5f215f24470e075a4ae9aeb944
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
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>