diff options
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/CMakeLists.txt | 6 | ||||
-rw-r--r-- | tests/auto/cmake/test_interface/CMakeLists.txt | 20 | ||||
-rw-r--r-- | tests/auto/cmake/test_interface/widget_test/CMakeLists.txt | 12 | ||||
-rw-r--r-- | tests/auto/cmake/test_interface/widget_test/main.cpp | 4 | ||||
-rw-r--r-- | tests/auto/corelib/global/qlogging/tst_qlogging.cpp | 6 |
5 files changed, 33 insertions, 15 deletions
diff --git a/tests/auto/CMakeLists.txt b/tests/auto/CMakeLists.txt index 2452e1a5d8..c16c8b197b 100644 --- a/tests/auto/CMakeLists.txt +++ b/tests/auto/CMakeLists.txt @@ -22,6 +22,12 @@ if (TARGET Qt::Xml AND TARGET Qt::Sql AND TARGET Qt::Network) add_subdirectory(cmake) endif() # special case end + +# Limit set of tests to run for static Qt builds. +if(QT_BUILD_MINIMAL_STATIC_TESTS) + return() +endif() + if (TARGET Qt::Concurrent) add_subdirectory(concurrent) endif() 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 <QString> -#include <QWidget> - -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 ) diff --git a/tests/auto/cmake/test_interface/widget_test/CMakeLists.txt b/tests/auto/cmake/test_interface/widget_test/CMakeLists.txt new file mode 100644 index 0000000000..679d01ef63 --- /dev/null +++ b/tests/auto/cmake/test_interface/widget_test/CMakeLists.txt @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 3.14) + +project(test_interface_try_compile) + +find_package(Qt6Widgets) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +add_executable(test_interface_try_compile_exe main.cpp) +target_link_libraries(test_interface_try_compile_exe Qt::Widgets) + diff --git a/tests/auto/cmake/test_interface/widget_test/main.cpp b/tests/auto/cmake/test_interface/widget_test/main.cpp new file mode 100644 index 0000000000..e6a8ab5fe9 --- /dev/null +++ b/tests/auto/cmake/test_interface/widget_test/main.cpp @@ -0,0 +1,4 @@ +#include <QString> +#include <QWidget> + +int main(int, char**) { QWidget w; w.show(); return 0; } diff --git a/tests/auto/corelib/global/qlogging/tst_qlogging.cpp b/tests/auto/corelib/global/qlogging/tst_qlogging.cpp index 7667cb278e..b089381272 100644 --- a/tests/auto/corelib/global/qlogging/tst_qlogging.cpp +++ b/tests/auto/corelib/global/qlogging/tst_qlogging.cpp @@ -746,6 +746,9 @@ void tst_qmessagehandler::qMessagePattern_data() #define QT_NAMESPACE_STR "" #endif +#if QT_CONFIG(static) + QSKIP("These test cases don't work with static Qt builds"); +#else #ifndef QT_NO_DEBUG QTest::newRow("backtrace") << "[%{backtrace}] %{message}" << true << (QList<QByteArray>() // MyClass::qt_static_metacall is explicitly marked as hidden in the Q_OBJECT macro @@ -755,7 +758,8 @@ void tst_qmessagehandler::qMessagePattern_data() QTest::newRow("backtrace depth,separator") << "[%{backtrace depth=2 separator=\"\n\"}] %{message}" << true << (QList<QByteArray>() << "[MyClass::myFunction\nMyClass::mySlot1] from_a_function 34" << "[T::T\n"); -#endif +#endif // #if !QT_CONFIG(process) +#endif // #ifdef __GLIBC__ } |