summaryrefslogtreecommitdiffstats
path: root/src/corelib/Qt6CTestMacros.cmake
Commit message (Collapse)AuthorAgeFilesLines
* CMake: Choose better defaults for qt_add_plugin STATIC/SHAREDAlexandru Croitor2021-04-071-3/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There was a recent behavior change where the public CMake API qt_add_plugin API took into account the value of BUILD_SHARED_LIBS to decide whether the plugin should be a static or shared library. Instead, use the following new behavior - If no explicit option STATIC / SHARED option is passed, default to whatever flavor Qt was built as. Aka if Qt was configured with -shared, qt_add_plugin defaults to creating shared plugins. If it's a -static Qt, create static plugins. - If an explicit STATIC / SHARED option is set, override the default computed value with the given value. As a result BUILD_SHARED_LIBS does not affect Qt plugins anymore. This is more in line with Qt expectations. Add SHARED as a new valid option to pass to qt_add_plugin (it wasn't before). Add tests to check for the above behavior. Amends aa4a1006cbccbc180c600f9b4dc9e882bb5ed5ca Fixes: QTBUG-92361 Task-number: QTBUG-88763 Change-Id: Iae806024ddd5cf10cfe58ddbcebd2818084b0bd7 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit d0c2425d791edd75e35cce65ddbcfaab9a7f16ed) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Rework the failure macros in the Qt CTest kitAlexey Edelev2021-03-241-1/+13
| | | | | | | | | | | | The _qt_internal_test_expect_fail macro fails when the test fails during the configuration step. Rename this macro to _qt_internal_test_expect_build_fail and add the _qt_internal_test_expect_fail macro that expects inverted test result. Change-Id: I4635e99152f7a32f5c48202e84fec59800453d34 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit fec5b8e81c976b8b0cdf45b459f7d481222e86d7)
* CMake: Fix qtbase cmake tests to pass when configured in-treeAlexandru Croitor2020-11-101-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | As opposed to standalone tests. The problem is that 4 of the cmake failbuild tests use try_compile as an indirection layer to configure /another/ project which is actually the test. That project needs to know the location of Qt. To do that, a FindPackageHints.cmake file is included and the variable it sets is passed to find_package() HINTS option. That's enough to find a specific module, but not any dependent Tools packages. Work around that by adding the Qt location to CMAKE_PREFIX_PATH in the included FindPackageHints.cmake file. The problem does not happen in standalone tests, because the Qt location ends up being propagated via the qt toolchain file, which does get inherited by the compile tests (albeit in a weird way, where a reconfiguration still shows CMAKE_PREFIX_PATH to be empty). Change-Id: I1f7ce940fd31678b46c0356edf6581e523cb885a Fixes: QTBUG-86963 Reviewed-by: Andreas Buhr <andreas.buhr@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Normalize dir separators in CMAKE_TOOLCHAIN_FILE when forwarded to CTestKai Koehne2020-11-061-1/+2
| | | | | | | | | | | | | | | | | | | | This fixes an issue where, on Windows, 'ninja test' will error out: [0/1] Running tests... Test project C:/dev/qt/dev/cmake-msvc-2019-amd64/qttools CMake Warning (dev) at C:/dev/qt/dev/cmake-msvc-2019-amd64/qttools/tests/auto/cmake/CTestTestfile.cmake:7 (add_test): Syntax error in cmake code at C:/dev/qt/dev/cmake-msvc-2019-amd64/qttools/tests/auto/cmake/CTestTestfile.cmake:7 when parsing string -DCMAKE_TOOLCHAIN_FILE=C:\dev\qt\dev\cmake-msvc-2019-amd64\qtbase\bin\/../lib/cmake/Qt6/qt.toolchain.cmake Invalid escape sequence \d Change-Id: Ifc727e44b20b899b44c7c1398d4273d73b7519ca Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Clean up the public API a bitAlexandru Croitor2020-10-011-3/+3
| | | | | | | | | | Add some missing versionless functions. Rename some functions that are not meant to be public API, and their usages. Task-number: QTBUG-86827 Change-Id: Ifb66c04cd7598d83fe80c01a92ab2d269ebaf396 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Get tests/auto/cmake tests workingAlexandru Croitor2020-07-171-63/+95
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The tests/auto/cmake project can be configured separately as a standalone project with qt-cmake, or as part of the overall qtbase standalone tests. To do that a bunch of things were done - Ported all Qt5 strings to Qt6 - Replaced in all projects the use of add_definitions and include_directories with a target based approach, except for 2 tests where we check that the old-style approach works, otherwise the tests would file - Removed some (possibly unneeded) EGL / OpenGL tests - Fixed some C++ code - Added setup code to tests/auto/cmake/CMakeLists.txt to figure out which modules are available and should be tested - Fixed Qt6CTestMacros.cmake to be loaded by Qt6Core - Removed the CMake tests to not be run in qmake builds of Qt because they would fail anyway - Enabled the CMake tests to be part of standalone tests - Disabled auto-passing of the C and CXX compiler cache vars when cross-compiling so that the tests can somewhat pass on boot2qt. This is the issue we encountered in e2b2cd9397c76e91ac1ebe493bcac7696767c02e - Ultimately disabled tests for boot2qt, because the -rpath-link flag is not generated by CMake for some reason. - Added code to setup the environment when running an executable that was built as part of the test, so that the proper Qt libraries are found. This handles both the standalone tests case and separate project case. The remaining unported tests are test_import_plugins which requires quite a bit of work to get some modules and plugins built that were done as part of the qmake .pro files, test_plugins that checks some Network plugins which I'm not sure about, and test_add_big_resource which doesn't work with namespaced builds and there's no good way of detecting those at the moment either. Change-Id: Ic8809c72817d1db81af6c6014c11df6473ad8c75 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Merge remote-tracking branch 'origin/wip/qt6' into wip/cmakeAlexandru Croitor2019-06-141-0/+243
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