From 0e6c4224f00999d4089d7c2ac462bb5a60a14adc Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Mon, 15 Mar 2021 17:03:38 +0100 Subject: CMake: Build minimal subset of tests in desktop static builds Add new configure option -make minimal-static-tests and CMake option QT_BUILD_MINIMAL_STATIC_TESTS. In conjunction with QT_BUILD_TESTS it will enable building a minimal subset of tests when targeting a static desktop Qt build. In qtbase the minimal subset includes all the auto tests of testlib, tools, corelib and cmake. In particular this will also do cmake build tests and qmake build tests (tst_qmake) Adjust CI instructions to enable building a minimal subset of static tests when a platform configuration is tagged with the MinimalStaticTests feature. Fix and skip a few tests that were failing. Pick-to: 6.1 Task-number: QTBUG-87580 Task-number: QTBUG-91869 Change-Id: I1fc311b8d5e743ccf05047fb9a7fdb813a645206 Reviewed-by: Joerg Bornemann --- tests/auto/cmake/test_interface/CMakeLists.txt | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) (limited to 'tests/auto/cmake/test_interface/CMakeLists.txt') diff --git a/tests/auto/cmake/test_interface/CMakeLists.txt b/tests/auto/cmake/test_interface/CMakeLists.txt index 0cae16668e..d874ac561d 100644 --- a/tests/auto/cmake/test_interface/CMakeLists.txt +++ b/tests/auto/cmake/test_interface/CMakeLists.txt @@ -14,23 +14,15 @@ add_executable(test_interface_exe WIN32 main.cpp mainwindow.cpp) # link explicitly to Qt::WinMain. target_link_libraries(test_interface_exe Qt::Widgets) -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/try_compile-test.cpp" - " -#include -#include - -int main(int,char**) { QWidget w; w.show(); return 0; } -" -) - # Fix try_compile to inherit the parent configuration. set(CMAKE_TRY_COMPILE_CONFIGURATION "${CMAKE_BUILD_TYPE}") -# The try_compile works because Qt::Widgets is listed in the LINK_LIBRARIES, -# which causes the includes, defines and appropriate PIC flag to be used. -try_compile(_TRY_COMPILE_RES "${CMAKE_CURRENT_BINARY_DIR}/try_compile-test" - "${CMAKE_CURRENT_BINARY_DIR}/try_compile-test.cpp" - LINK_LIBRARIES Qt::Widgets +# Can't use source file based try_compile, because it doesn't handle object libraries +# referenced in generator expressions properly. +try_compile(_TRY_COMPILE_RES + "${CMAKE_CURRENT_BINARY_DIR}/widget_test" + "${CMAKE_CURRENT_SOURCE_DIR}/widget_test" + widget_test OUTPUT_VARIABLE TC_OV ) -- cgit v1.2.3