aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/cmake
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/cmake')
-rw-r--r--tests/auto/cmake/CMakeLists.txt23
-rw-r--r--tests/auto/cmake/empty_qmldir/enemy.cpp2
-rw-r--r--tests/auto/cmake/empty_qmldir/enemy.h2
-rw-r--r--tests/auto/cmake/empty_qmldir/main.cpp2
-rw-r--r--tests/auto/cmake/qmlimportscanner/main.cpp2
-rw-r--r--tests/auto/cmake/qmlquery/CMakeLists.txt1
-rw-r--r--tests/auto/cmake/qmlquery/My/OtherThings/CMakeLists.txt28
-rw-r--r--tests/auto/cmake/qmlquery/My/OtherThings/test.cpp3
-rw-r--r--tests/auto/cmake/qmlquery/My/OtherThings/test.h18
-rw-r--r--tests/auto/cmake/qtquickcompiler/main.cpp2
-rw-r--r--tests/auto/cmake/shared_qml_module/CMakeLists.txt14
-rw-r--r--tests/auto/cmake/shared_qml_module/Scheduler/CMakeLists.txt33
-rw-r--r--tests/auto/cmake/shared_qml_module/Scheduler/MainScreen.qml5
-rw-r--r--tests/auto/cmake/shared_qml_module/Scheduler/schedulerglobal.h15
-rw-r--r--tests/auto/cmake/shared_qml_module/Scheduler/task.cpp47
-rw-r--r--tests/auto/cmake/shared_qml_module/Scheduler/task.h34
-rw-r--r--tests/auto/cmake/shared_qml_module/SchedulerApp/CMakeLists.txt44
-rw-r--r--tests/auto/cmake/shared_qml_module/SchedulerApp/Main.qml12
-rw-r--r--tests/auto/cmake/shared_qml_module/SchedulerApp/main.cpp21
-rw-r--r--tests/auto/cmake/shared_qml_module/external/CMakeLists.txt1
-rw-r--r--tests/auto/cmake/shared_qml_module/external/nested/module/CMakeLists.txt15
-rw-r--r--tests/auto/cmake/shared_qml_module/external/nested/module/Test.qml3
-rw-r--r--tests/auto/cmake/shared_qml_module/tests/CMakeLists.txt1
-rw-r--r--tests/auto/cmake/shared_qml_module/tests/auto/CMakeLists.txt1
-rw-r--r--tests/auto/cmake/shared_qml_module/tests/auto/unit/CMakeLists.txt40
-rw-r--r--tests/auto/cmake/shared_qml_module/tests/auto/unit/dummy.cpp1
-rw-r--r--tests/auto/cmake/shared_qml_module/tests/auto/unit/tst_models.cpp45
-rw-r--r--tests/auto/cmake/test_common_import_path/CMakeLists.txt5
-rw-r--r--tests/auto/cmake/test_common_import_path/main.cpp2
-rw-r--r--tests/auto/cmake/test_generate_qmlls_ini/CMakeLists.txt43
-rw-r--r--tests/auto/cmake/test_generate_qmlls_ini/Dotted/CMakeLists.txt4
-rw-r--r--tests/auto/cmake/test_generate_qmlls_ini/Dotted/Uri/CMakeLists.txt9
-rw-r--r--tests/auto/cmake/test_generate_qmlls_ini/Dotted/Uri/Hello/CMakeLists.txt4
-rw-r--r--tests/auto/cmake/test_generate_qmlls_ini/Dotted/Uri/Hello/World/CMakeLists.txt7
-rw-r--r--tests/auto/cmake/test_generate_qmlls_ini/Dotted/Uri/Hello/World/Main.qml4
-rw-r--r--tests/auto/cmake/test_generate_qmlls_ini/Dotted/Uri/Main.qml4
-rw-r--r--tests/auto/cmake/test_generate_qmlls_ini/Main.qml5
-rw-r--r--tests/auto/cmake/test_generate_qmlls_ini/SomeSubfolder/CMakeLists.txt13
-rw-r--r--tests/auto/cmake/test_generate_qmlls_ini/SomeSubfolder/Main.qml5
-rw-r--r--tests/auto/cmake/test_generate_qmlls_ini/main.cpp98
-rw-r--r--tests/auto/cmake/test_import_static_shapes_plugin_resources/app.qml2
-rw-r--r--tests/auto/cmake/test_import_static_shapes_plugin_resources/tst_main.cpp2
-rw-r--r--tests/auto/cmake/test_internal_singleton/CMakeLists.txt23
-rw-r--r--tests/auto/cmake/test_internal_singleton/Test.qml4
-rw-r--r--tests/auto/cmake/test_link_qml_module_without_target/Base/Base.cpp10
-rw-r--r--tests/auto/cmake/test_link_qml_module_without_target/Base/Base.h16
-rw-r--r--tests/auto/cmake/test_link_qml_module_without_target/Base/CMakeLists.txt13
-rw-r--r--tests/auto/cmake/test_link_qml_module_without_target/Base/qml/Red.qml10
-rw-r--r--tests/auto/cmake/test_link_qml_module_without_target/CMakeLists.txt59
-rw-r--r--tests/auto/cmake/test_link_qml_module_without_target/Derived/CMakeLists.txt42
-rw-r--r--tests/auto/cmake/test_link_qml_module_without_target/Derived/qml/Blue.qml10
-rw-r--r--tests/auto/cmake/test_link_qml_module_without_target/Derived/qml/main.qml23
-rw-r--r--tests/auto/cmake/test_link_qml_module_without_target/main.cpp43
-rw-r--r--tests/auto/cmake/test_qml_app_deployment/Shapes/EllipseShape/ellipseitem.cpp2
-rw-r--r--tests/auto/cmake/test_qml_app_deployment/Shapes/EllipseShape/ellipseitem.h2
-rw-r--r--tests/auto/cmake/test_qml_app_deployment/Shapes/FunkyShape/FunkyItemQml.qml2
-rw-r--r--tests/auto/cmake/test_qml_app_deployment/Shapes/FunkyShape/funkyitem.cpp2
-rw-r--r--tests/auto/cmake/test_qml_app_deployment/Shapes/FunkyShape/funkyitem.h2
-rw-r--r--tests/auto/cmake/test_qml_app_deployment/main.cpp2
-rw-r--r--tests/auto/cmake/test_qml_app_deployment/main.qml2
-rw-r--r--tests/auto/cmake/test_static_qml_module/CMakeLists.txt38
-rw-r--r--tests/auto/cmake/test_static_qml_module/MyElement.cpp4
-rw-r--r--tests/auto/cmake/test_static_qml_module/MyElement.h20
-rw-r--r--tests/auto/cmake/test_static_qml_module/main.cpp35
-rw-r--r--tests/auto/cmake/test_static_qml_module/main.qml7
-rw-r--r--tests/auto/cmake/tooling_imports/First/Neighbor.cpp2
-rw-r--r--tests/auto/cmake/tooling_imports/First/Neighbor.h9
-rw-r--r--tests/auto/cmake/tooling_imports/main.cpp2
68 files changed, 987 insertions, 19 deletions
diff --git a/tests/auto/cmake/CMakeLists.txt b/tests/auto/cmake/CMakeLists.txt
index fd2053176a..9d2ef3bd88 100644
--- a/tests/auto/cmake/CMakeLists.txt
+++ b/tests/auto/cmake/CMakeLists.txt
@@ -93,6 +93,12 @@ if(TARGET Qt::Quick)
)
endif()
+if(TARGET Qt::QuickControls2)
+ list(APPEND module_includes
+ QuickControls2 QQuickStyle
+ )
+endif()
+
_qt_internal_test_module_includes(${module_includes})
if(TARGET Qt::Qml)
@@ -110,10 +116,20 @@ if(TARGET Qt::Qml)
If(NOT ANDROID) # QML only project cannot run on Android with C++ enty point
_qt_internal_test_expect_pass(qmlquery)
endif()
+ _qt_internal_test_expect_fail(test_internal_singleton)
+
+ # Make sure that we don't attempt to run binary when crosscompiling
+ if(NOT CMAKE_CROSSCOMPILING)
+ set(test_static_qml_module_extra_args BINARY test_static_qml_module)
+ else()
+ set(test_static_qml_module_extra_args "")
+ endif()
+ _qt_internal_test_expect_pass(test_static_qml_module ${test_static_qml_module_extra_args})
endif()
if(TARGET Qt::Quick)
if(NOT CMAKE_CROSSCOMPILING)
+ _qt_internal_test_expect_pass(shared_qml_module)
_qt_internal_test_expect_pass(qtquickcompiler BINARY qqc_test)
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.21")
_qt_internal_test_expect_pass(test_common_import_path
@@ -121,6 +137,12 @@ if(TARGET Qt::Quick)
BINARY cmake_test
)
endif()
+ if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.19")
+ _qt_internal_test_expect_pass(test_generate_qmlls_ini BINARY tst_generate_qmlls_ini)
+ endif()
+ _qt_internal_test_expect_pass(
+ test_link_qml_module_without_target
+ BINARY test_link_qml_module_without_target)
endif()
if(NOT QT6_IS_SHARED_LIBS_BUILD)
_qt_internal_test_expect_pass(test_import_static_shapes_plugin_resources
@@ -135,4 +157,3 @@ if(TARGET Qt::Quick)
endif()
endif()
endif()
-
diff --git a/tests/auto/cmake/empty_qmldir/enemy.cpp b/tests/auto/cmake/empty_qmldir/enemy.cpp
index 5365d75e05..2821cef07c 100644
--- a/tests/auto/cmake/empty_qmldir/enemy.cpp
+++ b/tests/auto/cmake/empty_qmldir/enemy.cpp
@@ -1,5 +1,5 @@
// Copyright (C) 2021 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "enemy.h"
diff --git a/tests/auto/cmake/empty_qmldir/enemy.h b/tests/auto/cmake/empty_qmldir/enemy.h
index 051176c8f6..96b3516884 100644
--- a/tests/auto/cmake/empty_qmldir/enemy.h
+++ b/tests/auto/cmake/empty_qmldir/enemy.h
@@ -1,5 +1,5 @@
// Copyright (C) 2021 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef ENEMY_H
#define ENEMY_H
diff --git a/tests/auto/cmake/empty_qmldir/main.cpp b/tests/auto/cmake/empty_qmldir/main.cpp
index e5a2176253..8bb5981bd9 100644
--- a/tests/auto/cmake/empty_qmldir/main.cpp
+++ b/tests/auto/cmake/empty_qmldir/main.cpp
@@ -1,5 +1,5 @@
// Copyright (C) 2021 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtCore/qobject.h>
#include <QtQml/qqml.h>
diff --git a/tests/auto/cmake/qmlimportscanner/main.cpp b/tests/auto/cmake/qmlimportscanner/main.cpp
index 8b6cc65c87..7dc3c46ca1 100644
--- a/tests/auto/cmake/qmlimportscanner/main.cpp
+++ b/tests/auto/cmake/qmlimportscanner/main.cpp
@@ -1,5 +1,5 @@
// Copyright (C) 2019 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtCore>
#include <QtQml>
diff --git a/tests/auto/cmake/qmlquery/CMakeLists.txt b/tests/auto/cmake/qmlquery/CMakeLists.txt
index 5baac4f967..bafabe70f2 100644
--- a/tests/auto/cmake/qmlquery/CMakeLists.txt
+++ b/tests/auto/cmake/qmlquery/CMakeLists.txt
@@ -8,3 +8,4 @@ find_package(Qt6 REQUIRED COMPONENTS Qml)
set(CMAKE_AUTOMOC TRUE)
add_subdirectory(My/Things)
+add_subdirectory(My/OtherThings)
diff --git a/tests/auto/cmake/qmlquery/My/OtherThings/CMakeLists.txt b/tests/auto/cmake/qmlquery/My/OtherThings/CMakeLists.txt
new file mode 100644
index 0000000000..5d2bbc4fdd
--- /dev/null
+++ b/tests/auto/cmake/qmlquery/My/OtherThings/CMakeLists.txt
@@ -0,0 +1,28 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+qt_policy(SET QTP0001 NEW)
+
+function(verify_result keyword expected actual)
+ if(NOT "${actual}" STREQUAL "${expected}")
+ message(SEND_ERROR
+ " Expected ${keyword}: ${expected}\n"
+ " Actual ${keyword}: ${actual}"
+ )
+ endif()
+endfunction()
+
+qt_add_qml_module(MyOtherThings
+ URI My.OtherThings
+ SOURCES
+ test.h test.cpp
+)
+
+qt_query_qml_module(MyOtherThings
+ QML_FILES qml_files2
+ RESOURCES resources2
+)
+
+# empty resources and files
+verify_result(RESOURCES "${resources2}" "")
+verify_result(QML_FILES "${qml_files2}" "")
diff --git a/tests/auto/cmake/qmlquery/My/OtherThings/test.cpp b/tests/auto/cmake/qmlquery/My/OtherThings/test.cpp
new file mode 100644
index 0000000000..b9dde77775
--- /dev/null
+++ b/tests/auto/cmake/qmlquery/My/OtherThings/test.cpp
@@ -0,0 +1,3 @@
+#include "test.h"
+
+Test::Test() {}
diff --git a/tests/auto/cmake/qmlquery/My/OtherThings/test.h b/tests/auto/cmake/qmlquery/My/OtherThings/test.h
new file mode 100644
index 0000000000..93f71766a8
--- /dev/null
+++ b/tests/auto/cmake/qmlquery/My/OtherThings/test.h
@@ -0,0 +1,18 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef TEST_H
+#define TEST_H
+
+#include <QtQml/qqml.h>
+#include <QObject>
+
+class Test : public QObject
+{
+ Q_OBJECT
+ QML_ELEMENT
+public:
+ Test();
+};
+
+#endif // TEST_H
diff --git a/tests/auto/cmake/qtquickcompiler/main.cpp b/tests/auto/cmake/qtquickcompiler/main.cpp
index 4cfc0bab2e..6780374dd3 100644
--- a/tests/auto/cmake/qtquickcompiler/main.cpp
+++ b/tests/auto/cmake/qtquickcompiler/main.cpp
@@ -1,5 +1,5 @@
// Copyright (C) 2021 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtCore>
#include <QtQml>
diff --git a/tests/auto/cmake/shared_qml_module/CMakeLists.txt b/tests/auto/cmake/shared_qml_module/CMakeLists.txt
new file mode 100644
index 0000000000..867caa4aad
--- /dev/null
+++ b/tests/auto/cmake/shared_qml_module/CMakeLists.txt
@@ -0,0 +1,14 @@
+cmake_minimum_required(VERSION 3.16)
+
+project(scheduler VERSION 0.1 LANGUAGES CXX)
+
+find_package(Qt6 REQUIRED COMPONENTS Qml)
+qt_standard_project_setup(REQUIRES 6.8)
+
+add_custom_target(custom_qmllint_target ALL)
+set(QT_QMLLINT_ALL_TARGET custom_qmllint_target)
+
+add_subdirectory(external)
+add_subdirectory(Scheduler)
+add_subdirectory(SchedulerApp)
+add_subdirectory(tests)
diff --git a/tests/auto/cmake/shared_qml_module/Scheduler/CMakeLists.txt b/tests/auto/cmake/shared_qml_module/Scheduler/CMakeLists.txt
new file mode 100644
index 0000000000..a40688d3a3
--- /dev/null
+++ b/tests/auto/cmake/shared_qml_module/Scheduler/CMakeLists.txt
@@ -0,0 +1,33 @@
+cmake_minimum_required(VERSION 3.16)
+
+project(scheduler VERSION 0.1 LANGUAGES CXX)
+
+set(CMAKE_CXX_STANDARD_REQUIRED ON)
+
+find_package(Qt6 6.5 REQUIRED COMPONENTS Quick)
+
+qt_add_qml_module(scheduler
+ URI Scheduler
+ VERSION 1.0
+ SOURCES
+ task.h
+ task.cpp
+ schedulerglobal.h
+ QML_FILES
+ MainScreen.qml
+)
+
+target_compile_definitions(scheduler
+ PRIVATE
+ SCHEDULER_LIBRARY
+)
+
+target_include_directories(scheduler
+ PUBLIC
+ ${CMAKE_CURRENT_SOURCE_DIR}
+)
+
+target_link_libraries(scheduler
+ PRIVATE
+ Qt6::Quick
+)
diff --git a/tests/auto/cmake/shared_qml_module/Scheduler/MainScreen.qml b/tests/auto/cmake/shared_qml_module/Scheduler/MainScreen.qml
new file mode 100644
index 0000000000..6260b4f918
--- /dev/null
+++ b/tests/auto/cmake/shared_qml_module/Scheduler/MainScreen.qml
@@ -0,0 +1,5 @@
+import QtQuick
+
+Rectangle {
+ color: "tomato"
+}
diff --git a/tests/auto/cmake/shared_qml_module/Scheduler/schedulerglobal.h b/tests/auto/cmake/shared_qml_module/Scheduler/schedulerglobal.h
new file mode 100644
index 0000000000..cd24bcc8b9
--- /dev/null
+++ b/tests/auto/cmake/shared_qml_module/Scheduler/schedulerglobal.h
@@ -0,0 +1,15 @@
+// Copyright (C) 2024 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef SCHEDULEGLOBAL_H
+#define SCHEDULEGLOBAL_H
+
+#include <QtGlobal>
+
+#if defined(SCHEDULER_LIBRARY)
+#define SCHEDULER_EXPORT Q_DECL_EXPORT
+#else
+#define SCHEDULER_EXPORT Q_DECL_IMPORT
+#endif
+
+#endif // SCHEDULEGLOBAL_H
diff --git a/tests/auto/cmake/shared_qml_module/Scheduler/task.cpp b/tests/auto/cmake/shared_qml_module/Scheduler/task.cpp
new file mode 100644
index 0000000000..534a614139
--- /dev/null
+++ b/tests/auto/cmake/shared_qml_module/Scheduler/task.cpp
@@ -0,0 +1,47 @@
+// Copyright (C) 2024 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "task.h"
+
+Task::Task()
+{
+}
+
+Task::Task(const QString &name, int durationInMinutes)
+ : mName(name)
+ , mDurationInMinutes(durationInMinutes)
+{
+}
+
+QString Task::name() const
+{
+ return mName;
+}
+
+void Task::setName(const QString &name)
+{
+ mName = name;
+}
+
+int Task::durationInMinutes() const
+{
+ return mDurationInMinutes;
+}
+
+void Task::setDurationInMinutes(int durationInMinutes)
+{
+ mDurationInMinutes = durationInMinutes;
+}
+
+bool Task::read(const QJsonObject &json)
+{
+ mName = json.value("name").toString();
+ mDurationInMinutes = json.value("durationInMinutes").toInt();
+ return true;
+}
+
+void Task::write(QJsonObject &json) const
+{
+ json["name"] = mName;
+ json["durationInMinutes"] = mDurationInMinutes;
+}
diff --git a/tests/auto/cmake/shared_qml_module/Scheduler/task.h b/tests/auto/cmake/shared_qml_module/Scheduler/task.h
new file mode 100644
index 0000000000..916f939508
--- /dev/null
+++ b/tests/auto/cmake/shared_qml_module/Scheduler/task.h
@@ -0,0 +1,34 @@
+// Copyright (C) 2024 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef TASK_H
+#define TASK_H
+
+#include <QObject>
+#include <QJsonObject>
+
+#include "schedulerglobal.h"
+
+class SCHEDULER_EXPORT Task : public QObject
+{
+ Q_OBJECT
+
+public:
+ Task();
+ Task(const QString &name, int durationInMinutes);
+
+ bool read(const QJsonObject &json);
+ void write(QJsonObject &json) const;
+
+ QString name() const;
+ void setName(const QString &name);
+
+ int durationInMinutes() const;
+ void setDurationInMinutes(int durationInMinutes);
+
+private:
+ QString mName;
+ int mDurationInMinutes = 0;
+};
+
+#endif // TASK_H
diff --git a/tests/auto/cmake/shared_qml_module/SchedulerApp/CMakeLists.txt b/tests/auto/cmake/shared_qml_module/SchedulerApp/CMakeLists.txt
new file mode 100644
index 0000000000..fdbb1df701
--- /dev/null
+++ b/tests/auto/cmake/shared_qml_module/SchedulerApp/CMakeLists.txt
@@ -0,0 +1,44 @@
+cmake_minimum_required(VERSION 3.16)
+
+project(schedulerapp VERSION 0.1 LANGUAGES CXX)
+
+set(CMAKE_CXX_STANDARD_REQUIRED ON)
+
+find_package(Qt6 6.5 REQUIRED COMPONENTS Quick)
+
+qt_add_executable(schedulerapp
+ main.cpp
+)
+
+qt_add_qml_module(schedulerapp
+ URI SchedulerApp
+ DEPENDENCIES
+ TARGET scheduler
+ IMPORTS
+ TARGET nested_module
+ VERSION 1.0
+ QML_FILES
+ Main.qml
+)
+
+# Qt for iOS sets MACOSX_BUNDLE_GUI_IDENTIFIER automatically since Qt 6.1.
+# If you are developing for iOS or macOS you should consider setting an
+# explicit, fixed bundle identifier manually though.
+set_target_properties(schedulerapp PROPERTIES
+# MACOSX_BUNDLE_GUI_IDENTIFIER com.example.schedulerapp
+ MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
+ MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
+ MACOSX_BUNDLE TRUE
+ WIN32_EXECUTABLE TRUE
+)
+
+target_link_libraries(schedulerapp
+ PRIVATE Qt6::Quick
+)
+
+include(GNUInstallDirs)
+install(TARGETS schedulerapp
+ BUNDLE DESTINATION .
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+)
diff --git a/tests/auto/cmake/shared_qml_module/SchedulerApp/Main.qml b/tests/auto/cmake/shared_qml_module/SchedulerApp/Main.qml
new file mode 100644
index 0000000000..4dddb35ae8
--- /dev/null
+++ b/tests/auto/cmake/shared_qml_module/SchedulerApp/Main.qml
@@ -0,0 +1,12 @@
+import QtQuick.Controls
+import Scheduler
+
+ApplicationWindow {
+ width: 640
+ height: 480
+ visible: true
+ title: qsTr("Scheduler")
+
+ MainScreen {}
+ Test {}
+}
diff --git a/tests/auto/cmake/shared_qml_module/SchedulerApp/main.cpp b/tests/auto/cmake/shared_qml_module/SchedulerApp/main.cpp
new file mode 100644
index 0000000000..6422d91bfa
--- /dev/null
+++ b/tests/auto/cmake/shared_qml_module/SchedulerApp/main.cpp
@@ -0,0 +1,21 @@
+// Copyright (C) 2024 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+//
+#include <QGuiApplication>
+#include <QQmlApplicationEngine>
+
+
+int main(int argc, char *argv[])
+{
+ QGuiApplication app(argc, argv);
+
+ qputenv("QT_QUICK_CONTROLS_STYLE", "Material");
+
+ QQmlApplicationEngine engine;
+ QObject::connect(&engine, &QQmlApplicationEngine::objectCreationFailed,
+ &app, []() { QCoreApplication::exit(-1); },
+ Qt::QueuedConnection);
+ engine.loadFromModule("SchedulerApp", "Main");
+
+ return app.exec();
+}
diff --git a/tests/auto/cmake/shared_qml_module/external/CMakeLists.txt b/tests/auto/cmake/shared_qml_module/external/CMakeLists.txt
new file mode 100644
index 0000000000..798a23e1a5
--- /dev/null
+++ b/tests/auto/cmake/shared_qml_module/external/CMakeLists.txt
@@ -0,0 +1 @@
+add_subdirectory(nested/module)
diff --git a/tests/auto/cmake/shared_qml_module/external/nested/module/CMakeLists.txt b/tests/auto/cmake/shared_qml_module/external/nested/module/CMakeLists.txt
new file mode 100644
index 0000000000..da75d2333a
--- /dev/null
+++ b/tests/auto/cmake/shared_qml_module/external/nested/module/CMakeLists.txt
@@ -0,0 +1,15 @@
+
+cmake_minimum_required(VERSION 3.16)
+
+project(scheduler VERSION 0.1 LANGUAGES CXX)
+
+set(CMAKE_CXX_STANDARD_REQUIRED ON)
+
+find_package(Qt6 6.5 REQUIRED COMPONENTS Quick)
+
+qt_add_qml_module(nested_module
+ URI nested.module
+ VERSION 1.0
+ QML_FILES
+ Test.qml
+)
diff --git a/tests/auto/cmake/shared_qml_module/external/nested/module/Test.qml b/tests/auto/cmake/shared_qml_module/external/nested/module/Test.qml
new file mode 100644
index 0000000000..3052615aef
--- /dev/null
+++ b/tests/auto/cmake/shared_qml_module/external/nested/module/Test.qml
@@ -0,0 +1,3 @@
+import QtQuick
+
+Item {}
diff --git a/tests/auto/cmake/shared_qml_module/tests/CMakeLists.txt b/tests/auto/cmake/shared_qml_module/tests/CMakeLists.txt
new file mode 100644
index 0000000000..0653827192
--- /dev/null
+++ b/tests/auto/cmake/shared_qml_module/tests/CMakeLists.txt
@@ -0,0 +1 @@
+add_subdirectory(auto)
diff --git a/tests/auto/cmake/shared_qml_module/tests/auto/CMakeLists.txt b/tests/auto/cmake/shared_qml_module/tests/auto/CMakeLists.txt
new file mode 100644
index 0000000000..269aea0c60
--- /dev/null
+++ b/tests/auto/cmake/shared_qml_module/tests/auto/CMakeLists.txt
@@ -0,0 +1 @@
+add_subdirectory(unit)
diff --git a/tests/auto/cmake/shared_qml_module/tests/auto/unit/CMakeLists.txt b/tests/auto/cmake/shared_qml_module/tests/auto/unit/CMakeLists.txt
new file mode 100644
index 0000000000..9d5f1d9f5e
--- /dev/null
+++ b/tests/auto/cmake/shared_qml_module/tests/auto/unit/CMakeLists.txt
@@ -0,0 +1,40 @@
+cmake_minimum_required(VERSION 3.5)
+
+project(tst_models LANGUAGES CXX)
+
+enable_testing()
+
+find_package(Qt6 REQUIRED COMPONENTS Gui Test Quick)
+
+set(CMAKE_AUTOUIC ON)
+set(CMAKE_AUTOMOC ON)
+set(CMAKE_AUTORCC ON)
+
+set(CMAKE_CXX_STANDARD 11)
+set(CMAKE_CXX_STANDARD_REQUIRED ON)
+
+add_executable(tst_models tst_models.cpp)
+add_test(NAME tst_models COMMAND tst_models)
+
+target_link_libraries(tst_models
+ PRIVATE
+ scheduler
+ Qt6::Gui
+ Qt6::Test
+ Qt6::Quick
+)
+
+
+qt_add_qml_module(tst_models
+ URI unittest
+ DEPENDENCIES
+ TARGET scheduler
+)
+
+
+qt_add_executable(tst_models_dummy_helper dummy.cpp)
+qt_add_qml_module(tst_models_dummy_helper
+ URI unimportant
+ DEPENDENCIES
+ TARGET nested_module
+)
diff --git a/tests/auto/cmake/shared_qml_module/tests/auto/unit/dummy.cpp b/tests/auto/cmake/shared_qml_module/tests/auto/unit/dummy.cpp
new file mode 100644
index 0000000000..237c8ce181
--- /dev/null
+++ b/tests/auto/cmake/shared_qml_module/tests/auto/unit/dummy.cpp
@@ -0,0 +1 @@
+int main() {}
diff --git a/tests/auto/cmake/shared_qml_module/tests/auto/unit/tst_models.cpp b/tests/auto/cmake/shared_qml_module/tests/auto/unit/tst_models.cpp
new file mode 100644
index 0000000000..0a7119fbcc
--- /dev/null
+++ b/tests/auto/cmake/shared_qml_module/tests/auto/unit/tst_models.cpp
@@ -0,0 +1,45 @@
+// Copyright (C) 2024 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include <QtTest>
+
+
+class tst_models : public QObject
+{
+ Q_OBJECT
+
+public:
+ tst_models();
+ ~tst_models();
+
+private slots:
+ void initTestCase();
+ void cleanupTestCase();
+
+ void qtconf();
+};
+
+tst_models::tst_models() {}
+
+tst_models::~tst_models() {}
+
+void tst_models::initTestCase() {}
+
+void tst_models::cleanupTestCase() {}
+
+void tst_models::qtconf()
+{
+ auto importPaths = QLibraryInfo::paths(QLibraryInfo::QmlImportsPath);
+ QCOMPARE_GE(importPaths.size(), 2);
+ if (importPaths.at(0).endsWith("shared_qml_module")) {
+ QVERIFY(importPaths.at(1).endsWith("external/nested"));
+ } else if (importPaths.at(0).endsWith("external/nested")) {
+ QVERIFY(importPaths.at(1).endsWith("shared_qml_module"));
+ } else {
+ QFAIL("Expected import paths were not found");
+ }
+}
+
+QTEST_MAIN(tst_models)
+
+#include "tst_models.moc"
diff --git a/tests/auto/cmake/test_common_import_path/CMakeLists.txt b/tests/auto/cmake/test_common_import_path/CMakeLists.txt
index 6071128010..13af36846b 100644
--- a/tests/auto/cmake/test_common_import_path/CMakeLists.txt
+++ b/tests/auto/cmake/test_common_import_path/CMakeLists.txt
@@ -13,6 +13,11 @@ set(CMAKE_AUTOMOC ON)
# Simplify finding the backing targets' DLLs on Windows
if(WIN32)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
+else()
+ add_compile_options (
+ -Werror # Treat all warnings as errors
+ -Wshadow # Warn on shadowing
+ )
endif()
add_subdirectory(duck/tick)
diff --git a/tests/auto/cmake/test_common_import_path/main.cpp b/tests/auto/cmake/test_common_import_path/main.cpp
index 5cc81b1573..9430c94f31 100644
--- a/tests/auto/cmake/test_common_import_path/main.cpp
+++ b/tests/auto/cmake/test_common_import_path/main.cpp
@@ -1,5 +1,5 @@
// Copyright (C) 2022 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtQml/qqmlengine.h>
diff --git a/tests/auto/cmake/test_generate_qmlls_ini/CMakeLists.txt b/tests/auto/cmake/test_generate_qmlls_ini/CMakeLists.txt
new file mode 100644
index 0000000000..f0fa09a66a
--- /dev/null
+++ b/tests/auto/cmake/test_generate_qmlls_ini/CMakeLists.txt
@@ -0,0 +1,43 @@
+# Copyright (C) 2023 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+cmake_minimum_required(VERSION 3.19)
+project(tst_generate_qmlls_ini)
+
+find_package(Qt6 REQUIRED COMPONENTS Core Qml Test)
+
+qt_standard_project_setup()
+
+qt_add_executable(tst_generate_qmlls_ini main.cpp)
+target_link_libraries(tst_generate_qmlls_ini PRIVATE Qt6::Test)
+
+set(QT_QML_GENERATE_QMLLS_INI ON CACHE BOOL "" FORCE)
+
+add_subdirectory(SomeSubfolder)
+add_subdirectory(Dotted)
+
+qt_add_qml_module(tst_generate_qmlls_ini
+ URI MainModule
+ VERSION 1.0
+ NO_RESOURCE_TARGET_PATH
+ SOURCES
+ main.cpp
+ QML_FILES
+ Main.qml
+)
+target_compile_definitions(tst_generate_qmlls_ini
+ PRIVATE
+ "SOURCE_DIRECTORY=u\"${CMAKE_CURRENT_SOURCE_DIR}\"_s"
+ "BUILD_DIRECTORY=u\"${CMAKE_CURRENT_BINARY_DIR}\"_s"
+)
+
+qt_add_qml_module(Module
+ URI Module
+ VERSION 1.0
+ QML_FILES
+ Main.qml
+ OUTPUT_DIRECTORY ./qml/hello/subfolders/Module
+)
+
+# Ensure linting runs when building the default "all" target
+set_target_properties(all_qmllint PROPERTIES EXCLUDE_FROM_ALL FALSE)
diff --git a/tests/auto/cmake/test_generate_qmlls_ini/Dotted/CMakeLists.txt b/tests/auto/cmake/test_generate_qmlls_ini/Dotted/CMakeLists.txt
new file mode 100644
index 0000000000..e3d4518aae
--- /dev/null
+++ b/tests/auto/cmake/test_generate_qmlls_ini/Dotted/CMakeLists.txt
@@ -0,0 +1,4 @@
+# Copyright (C) 2024 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+add_subdirectory(Uri)
diff --git a/tests/auto/cmake/test_generate_qmlls_ini/Dotted/Uri/CMakeLists.txt b/tests/auto/cmake/test_generate_qmlls_ini/Dotted/Uri/CMakeLists.txt
new file mode 100644
index 0000000000..a2edbc25ce
--- /dev/null
+++ b/tests/auto/cmake/test_generate_qmlls_ini/Dotted/Uri/CMakeLists.txt
@@ -0,0 +1,9 @@
+# Copyright (C) 2024 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+qt_add_qml_module(DottedUri
+ URI Dotted.Uri
+ QML_FILES Main.qml
+)
+
+add_subdirectory(Hello)
diff --git a/tests/auto/cmake/test_generate_qmlls_ini/Dotted/Uri/Hello/CMakeLists.txt b/tests/auto/cmake/test_generate_qmlls_ini/Dotted/Uri/Hello/CMakeLists.txt
new file mode 100644
index 0000000000..ecceec7e73
--- /dev/null
+++ b/tests/auto/cmake/test_generate_qmlls_ini/Dotted/Uri/Hello/CMakeLists.txt
@@ -0,0 +1,4 @@
+# Copyright (C) 2024 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+add_subdirectory(World)
diff --git a/tests/auto/cmake/test_generate_qmlls_ini/Dotted/Uri/Hello/World/CMakeLists.txt b/tests/auto/cmake/test_generate_qmlls_ini/Dotted/Uri/Hello/World/CMakeLists.txt
new file mode 100644
index 0000000000..338674bc93
--- /dev/null
+++ b/tests/auto/cmake/test_generate_qmlls_ini/Dotted/Uri/Hello/World/CMakeLists.txt
@@ -0,0 +1,7 @@
+# Copyright (C) 2024 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+qt_add_qml_module(DottedUri2
+ URI Dotted.Uri.Hello.World
+ QML_FILES Main.qml
+)
diff --git a/tests/auto/cmake/test_generate_qmlls_ini/Dotted/Uri/Hello/World/Main.qml b/tests/auto/cmake/test_generate_qmlls_ini/Dotted/Uri/Hello/World/Main.qml
new file mode 100644
index 0000000000..f97cbcf115
--- /dev/null
+++ b/tests/auto/cmake/test_generate_qmlls_ini/Dotted/Uri/Hello/World/Main.qml
@@ -0,0 +1,4 @@
+import QtQuick
+
+Item {
+}
diff --git a/tests/auto/cmake/test_generate_qmlls_ini/Dotted/Uri/Main.qml b/tests/auto/cmake/test_generate_qmlls_ini/Dotted/Uri/Main.qml
new file mode 100644
index 0000000000..f97cbcf115
--- /dev/null
+++ b/tests/auto/cmake/test_generate_qmlls_ini/Dotted/Uri/Main.qml
@@ -0,0 +1,4 @@
+import QtQuick
+
+Item {
+}
diff --git a/tests/auto/cmake/test_generate_qmlls_ini/Main.qml b/tests/auto/cmake/test_generate_qmlls_ini/Main.qml
new file mode 100644
index 0000000000..68c21087cb
--- /dev/null
+++ b/tests/auto/cmake/test_generate_qmlls_ini/Main.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.15
+
+Item {
+
+}
diff --git a/tests/auto/cmake/test_generate_qmlls_ini/SomeSubfolder/CMakeLists.txt b/tests/auto/cmake/test_generate_qmlls_ini/SomeSubfolder/CMakeLists.txt
new file mode 100644
index 0000000000..ae6fb009f8
--- /dev/null
+++ b/tests/auto/cmake/test_generate_qmlls_ini/SomeSubfolder/CMakeLists.txt
@@ -0,0 +1,13 @@
+qt_add_qml_module(ModuleA
+ URI ModuleA
+ VERSION 1.0
+ QML_FILES Main.qml
+ OUTPUT_DIRECTORY ./qml/Some/Sub/Folder/ModuleA
+)
+
+qt_add_qml_module(ModuleB
+ URI ModuleB
+ VERSION 1.0
+ QML_FILES Main.qml
+ OUTPUT_DIRECTORY ./qml/Some/Sub/Folder/ModuleB
+)
diff --git a/tests/auto/cmake/test_generate_qmlls_ini/SomeSubfolder/Main.qml b/tests/auto/cmake/test_generate_qmlls_ini/SomeSubfolder/Main.qml
new file mode 100644
index 0000000000..68c21087cb
--- /dev/null
+++ b/tests/auto/cmake/test_generate_qmlls_ini/SomeSubfolder/Main.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.15
+
+Item {
+
+}
diff --git a/tests/auto/cmake/test_generate_qmlls_ini/main.cpp b/tests/auto/cmake/test_generate_qmlls_ini/main.cpp
new file mode 100644
index 0000000000..2d663cdc23
--- /dev/null
+++ b/tests/auto/cmake/test_generate_qmlls_ini/main.cpp
@@ -0,0 +1,98 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include <QtCore/qobject.h>
+#include <QtCore/qstring.h>
+#include <QtCore/qdir.h>
+#include <QtCore/qfile.h>
+#include <QtCore/qlibraryinfo.h>
+#include <QtQml/qqml.h>
+#include <QtTest/qtest.h>
+
+class tst_generate_qmlls_ini : public QObject
+{
+ Q_OBJECT
+private slots:
+ void qmllsIniAreCorrect();
+};
+
+using namespace Qt::StringLiterals;
+
+#ifndef SOURCE_DIRECTORY
+# define SOURCE_DIRECTORY u"invalid_source_directory"_s
+#endif
+#ifndef BUILD_DIRECTORY
+# define BUILD_DIRECTORY u"invalid_build_directory"_s
+#endif
+
+void tst_generate_qmlls_ini::qmllsIniAreCorrect()
+{
+ const QString qmllsIniName = u".qmlls.ini"_s;
+ QDir source(SOURCE_DIRECTORY);
+ QDir build(BUILD_DIRECTORY);
+ if (!source.exists())
+ QSKIP(u"Cannot find source directory '%1', skipping test..."_s.arg(SOURCE_DIRECTORY)
+ .toLatin1());
+
+ const QString &docPath = QLibraryInfo::path(QLibraryInfo::DocumentationPath);
+ {
+ auto file = QFile(source.absoluteFilePath(qmllsIniName));
+ QVERIFY(file.exists());
+ QVERIFY(file.open(QFile::ReadOnly | QFile::Text));
+ const auto fileContent = QString::fromUtf8(file.readAll());
+ auto secondFolder = QDir(build.absolutePath().append(u"/qml/hello/subfolders"_s));
+ QVERIFY(secondFolder.exists());
+ QCOMPARE(fileContent,
+ u"[General]\nbuildDir=%1%2%3\nno-cmake-calls=false\ndocDir=%4\n"_s.arg(build.absolutePath(), QDir::listSeparator(),
+ secondFolder.absolutePath(), docPath));
+ }
+
+ {
+ QDir sourceSubfolder = source;
+ QVERIFY(sourceSubfolder.cd(u"SomeSubfolder"_s));
+ QDir buildSubfolder(build.absolutePath().append(u"/SomeSubfolder/qml/Some/Sub/Folder"_s));
+ {
+ auto file = QFile(sourceSubfolder.absoluteFilePath(qmllsIniName));
+ QVERIFY(file.exists());
+ QVERIFY(file.open(QFile::ReadOnly | QFile::Text));
+ const auto fileContent = QString::fromUtf8(file.readAll());
+ QCOMPARE(fileContent,
+ u"[General]\nbuildDir=%1\nno-cmake-calls=false\ndocDir=%2\n"_s.arg(buildSubfolder.absolutePath(), docPath));
+ }
+ }
+
+ {
+ QDir dottedUriSubfolder = source;
+ QVERIFY(dottedUriSubfolder.cd(u"Dotted"_s));
+ QVERIFY(dottedUriSubfolder.cd(u"Uri"_s));
+ {
+ auto file = QFile(dottedUriSubfolder.absoluteFilePath(qmllsIniName));
+ QVERIFY(file.exists());
+ QVERIFY(file.open(QFile::ReadOnly | QFile::Text));
+ const auto fileContent = QString::fromUtf8(file.readAll());
+ QCOMPARE(
+ fileContent,
+ u"[General]\nbuildDir=%1\nno-cmake-calls=false\ndocDir=%2\n"_s.arg(build.absolutePath(), docPath));
+ }
+ }
+ {
+ QDir dottedUriSubfolder = source;
+ QVERIFY(dottedUriSubfolder.cd(u"Dotted"_s));
+ QVERIFY(dottedUriSubfolder.cd(u"Uri"_s));
+ QVERIFY(dottedUriSubfolder.cd(u"Hello"_s));
+ QVERIFY(dottedUriSubfolder.cd(u"World"_s));
+ {
+ auto file = QFile(dottedUriSubfolder.absoluteFilePath(qmllsIniName));
+ QVERIFY(file.exists());
+ QVERIFY(file.open(QFile::ReadOnly | QFile::Text));
+ const auto fileContent = QString::fromUtf8(file.readAll());
+ QCOMPARE(
+ fileContent,
+ u"[General]\nbuildDir=%1\nno-cmake-calls=false\ndocDir=%2\n"_s.arg(build.absolutePath(), docPath));
+ }
+ }
+}
+
+QTEST_MAIN(tst_generate_qmlls_ini)
+
+#include "main.moc"
diff --git a/tests/auto/cmake/test_import_static_shapes_plugin_resources/app.qml b/tests/auto/cmake/test_import_static_shapes_plugin_resources/app.qml
index e470b2e240..20a0d1db78 100644
--- a/tests/auto/cmake/test_import_static_shapes_plugin_resources/app.qml
+++ b/tests/auto/cmake/test_import_static_shapes_plugin_resources/app.qml
@@ -1,5 +1,5 @@
// Copyright (C) 2021 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick
import QtQuick.Shapes
diff --git a/tests/auto/cmake/test_import_static_shapes_plugin_resources/tst_main.cpp b/tests/auto/cmake/test_import_static_shapes_plugin_resources/tst_main.cpp
index 4d6265a9e6..5b99d8f22e 100644
--- a/tests/auto/cmake/test_import_static_shapes_plugin_resources/tst_main.cpp
+++ b/tests/auto/cmake/test_import_static_shapes_plugin_resources/tst_main.cpp
@@ -1,5 +1,5 @@
// Copyright (C) 2021 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtCore/QtGlobal>
#include <QtCore/QScopeGuard>
diff --git a/tests/auto/cmake/test_internal_singleton/CMakeLists.txt b/tests/auto/cmake/test_internal_singleton/CMakeLists.txt
new file mode 100644
index 0000000000..f1db46a0f9
--- /dev/null
+++ b/tests/auto/cmake/test_internal_singleton/CMakeLists.txt
@@ -0,0 +1,23 @@
+# Copyright (C) 2023 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+
+cmake_minimum_required(VERSION 3.19)
+
+project(test_internal_singleton)
+
+find_package(Qt6 REQUIRED COMPONENTS Qml)
+
+qt_standard_project_setup()
+
+set_source_files_properties(Test.qml PROPERTIES
+ QT_QML_SINGLETON_TYPE TRUE
+ QT_QML_INTERNAL_TYPE TRUE
+)
+
+qt_add_qml_module(test_internal_singleton
+ URI Controls
+ VERSION 1.0
+ QML_FILES
+ Test.qml
+)
diff --git a/tests/auto/cmake/test_internal_singleton/Test.qml b/tests/auto/cmake/test_internal_singleton/Test.qml
new file mode 100644
index 0000000000..a2eb03bd4e
--- /dev/null
+++ b/tests/auto/cmake/test_internal_singleton/Test.qml
@@ -0,0 +1,4 @@
+pragma singleton
+import QtQml
+
+QtObject {}
diff --git a/tests/auto/cmake/test_link_qml_module_without_target/Base/Base.cpp b/tests/auto/cmake/test_link_qml_module_without_target/Base/Base.cpp
new file mode 100644
index 0000000000..765c14383f
--- /dev/null
+++ b/tests/auto/cmake/test_link_qml_module_without_target/Base/Base.cpp
@@ -0,0 +1,10 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "Base.h"
+#include <QDebug>
+
+Base::Base(QObject *parent) : QObject(parent)
+{
+ qDebug() << Q_FUNC_INFO << "Base library loaded";
+}
diff --git a/tests/auto/cmake/test_link_qml_module_without_target/Base/Base.h b/tests/auto/cmake/test_link_qml_module_without_target/Base/Base.h
new file mode 100644
index 0000000000..9835131a57
--- /dev/null
+++ b/tests/auto/cmake/test_link_qml_module_without_target/Base/Base.h
@@ -0,0 +1,16 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef BASE_H
+#define BASE_H
+
+#include <QObject>
+
+class Base : public QObject
+{
+ Q_OBJECT
+public:
+ explicit Base(QObject *parent = nullptr);
+};
+
+#endif // BASE_H
diff --git a/tests/auto/cmake/test_link_qml_module_without_target/Base/CMakeLists.txt b/tests/auto/cmake/test_link_qml_module_without_target/Base/CMakeLists.txt
new file mode 100644
index 0000000000..1d94c8ea21
--- /dev/null
+++ b/tests/auto/cmake/test_link_qml_module_without_target/Base/CMakeLists.txt
@@ -0,0 +1,13 @@
+# Copyright (C) 2023 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+qt_add_library(Base STATIC)
+qt_add_qml_module(Base
+ URI "Base"
+ QML_FILES
+ qml/Red.qml
+ SOURCES
+ Base.cpp
+)
+
+target_link_libraries(Base PRIVATE Qt6::Quick)
diff --git a/tests/auto/cmake/test_link_qml_module_without_target/Base/qml/Red.qml b/tests/auto/cmake/test_link_qml_module_without_target/Base/qml/Red.qml
new file mode 100644
index 0000000000..c75f13d7a8
--- /dev/null
+++ b/tests/auto/cmake/test_link_qml_module_without_target/Base/qml/Red.qml
@@ -0,0 +1,10 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+
+Rectangle {
+ width: 320
+ height: 240
+ color: "red"
+}
diff --git a/tests/auto/cmake/test_link_qml_module_without_target/CMakeLists.txt b/tests/auto/cmake/test_link_qml_module_without_target/CMakeLists.txt
new file mode 100644
index 0000000000..86c43aa605
--- /dev/null
+++ b/tests/auto/cmake/test_link_qml_module_without_target/CMakeLists.txt
@@ -0,0 +1,59 @@
+# Copyright (C) 2023 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+cmake_minimum_required(VERSION 3.16)
+
+project(test_link_qml_module_without_target)
+
+find_package(Qt6 COMPONENTS REQUIRED
+ Core
+ Test
+ Quick
+ QuickLayouts
+ QuickTestUtilsPrivate
+)
+
+qt_standard_project_setup(REQUIRES 6.5)
+
+add_subdirectory(Base)
+add_subdirectory(Derived)
+
+qt6_add_executable(test_link_qml_module_without_target main.cpp)
+
+target_link_libraries(test_link_qml_module_without_target PRIVATE
+ Qt6::Core
+ Qt6::Test
+ Qt6::QuickPrivate
+ Qt6::QuickTestUtilsPrivate
+)
+
+# Suppress running qmlimportscanner and auto linking of static qml plugins, to ensure we don't
+# automatically link to the project-created qml module object library initializers.
+# Doing that would be at odds with what the test is trying to test.
+set_target_properties(test_link_qml_module_without_target PROPERTIES _QT_QML_PLUGINS_IMPORTED TRUE)
+
+# Because we disable qmlimportscanner auto-linking above, we need to manually link to the Qt
+# provided qml plugins used by the project. Note that we link to the plugins, and not the
+# backing libraries, to ensure we link to the initializer object libraries as well
+# (which are dependencies of the plugin targets).
+if(NOT QT6_IS_SHARED_LIBS_BUILD)
+ target_link_libraries(test_link_qml_module_without_target PRIVATE
+ Qt6::qtquick2plugin
+ Qt6::qquicklayoutsplugin
+ )
+endif()
+
+# Make sure we build the libraries before we link to them.
+add_dependencies(test_link_qml_module_without_target Base Baseplugin Derived Derivedplugin)
+
+# Link against the library files and not the targets, so that we can confirm
+# the ability to manually initialize the qml modules and their resources from inside main.cpp
+# using Q_IMPORT_QML_PLUGIN calls.
+# The order of libraries is important, the plugins need to come before the backing libraries
+# so that linkers like 'Linux ld' don't discard symbols that haven't yet been marked as required.
+target_link_libraries(test_link_qml_module_without_target PRIVATE
+ $<TARGET_FILE:Baseplugin>
+ $<TARGET_FILE:Base>
+ $<TARGET_FILE:Derivedplugin>
+ $<TARGET_FILE:Derived>
+)
diff --git a/tests/auto/cmake/test_link_qml_module_without_target/Derived/CMakeLists.txt b/tests/auto/cmake/test_link_qml_module_without_target/Derived/CMakeLists.txt
new file mode 100644
index 0000000000..08f1155e11
--- /dev/null
+++ b/tests/auto/cmake/test_link_qml_module_without_target/Derived/CMakeLists.txt
@@ -0,0 +1,42 @@
+# Copyright (C) 2023 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# See comment below why we do this conditionally.
+set(main_qml "qml/main.qml")
+if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.19")
+ set(qml_extra_files "")
+else()
+ set(qml_extra_files "${main_qml}")
+endif()
+
+qt_add_library(Derived STATIC)
+qt_add_qml_module(Derived
+ URI "Derived"
+ QML_FILES
+ qml/Blue.qml
+ ${qml_extra_files}
+)
+
+# The library has no cpp sources, prevent 'ranlib: has no symbols' warnings
+set_target_properties(Derived PROPERTIES AUTOMOC OFF)
+
+# Add one more qml source in a separate qt_target_qml_sources call,
+# to ensure we correctly create an additional resource for the same
+# qml module and that linking to the qml module plugin + calling
+# Q_IMPORT_PLUGIN will initialize the resource.
+# We can only do it with CMake 3.19+, otherwise we get a configure time
+# error in qt6_target_qml_sources.
+if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.19")
+ qt6_target_qml_sources(Derived
+ QML_FILES
+ ${main_qml}
+ )
+endif()
+
+# Make sure we build the libraries before we link to them.
+add_dependencies(Derived Base Baseplugin)
+
+# Manually link to the library files, to avoid bringing in any
+# object library dependencies.
+target_link_libraries(Derived PRIVATE $<TARGET_FILE:Base>)
+target_link_libraries(Derived PRIVATE $<TARGET_FILE:Baseplugin>)
diff --git a/tests/auto/cmake/test_link_qml_module_without_target/Derived/qml/Blue.qml b/tests/auto/cmake/test_link_qml_module_without_target/Derived/qml/Blue.qml
new file mode 100644
index 0000000000..10668894c2
--- /dev/null
+++ b/tests/auto/cmake/test_link_qml_module_without_target/Derived/qml/Blue.qml
@@ -0,0 +1,10 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+
+Rectangle {
+ width: 320
+ height: 240
+ color: "blue"
+}
diff --git a/tests/auto/cmake/test_link_qml_module_without_target/Derived/qml/main.qml b/tests/auto/cmake/test_link_qml_module_without_target/Derived/qml/main.qml
new file mode 100644
index 0000000000..7c797cf2ef
--- /dev/null
+++ b/tests/auto/cmake/test_link_qml_module_without_target/Derived/qml/main.qml
@@ -0,0 +1,23 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.Layouts
+import Base
+import Derived
+
+RowLayout {
+ width: 200
+ height: 200
+
+ Red {
+ id: red
+ width: 100
+ height: 100
+ }
+
+ Blue {
+ width: 100
+ height: 100
+ }
+}
diff --git a/tests/auto/cmake/test_link_qml_module_without_target/main.cpp b/tests/auto/cmake/test_link_qml_module_without_target/main.cpp
new file mode 100644
index 0000000000..a0795cb20d
--- /dev/null
+++ b/tests/auto/cmake/test_link_qml_module_without_target/main.cpp
@@ -0,0 +1,43 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include <QtCore/QDirIterator>
+#include <QtGui/QGuiApplication>
+#include <QtTest/QtTest>
+#include <QtQml/QQmlApplicationEngine>
+#include <QtQml/QQmlContext>
+#include <QtQml/qqmlextensionplugin.h>
+#include <QtQuick/QQuickView>
+#include <QtQuickTestUtils/private/viewtestutils_p.h>
+
+// Manually import the qml plugins so that the qml modules and their resources
+// are initialized.
+Q_IMPORT_QML_PLUGIN(BasePlugin)
+Q_IMPORT_QML_PLUGIN(DerivedPlugin)
+
+class TestLinkStaticQmlModule : public QObject
+{
+ Q_OBJECT
+private slots:
+ void canRun();
+};
+
+void TestLinkStaticQmlModule::canRun()
+{
+ // Show all the non-Qt loaded resources.
+ QDirIterator it(":", QDirIterator::Subdirectories);
+ while (it.hasNext()) {
+ const auto path = it.next();
+ if (!path.startsWith(u":/qt-project.org"_qs)) {
+ qDebug() << path;
+ }
+ }
+
+ QQuickView view;
+ QVERIFY(QFile::exists(":/qt/qml/Base/qml/Red.qml"));
+ QVERIFY(QFile::exists(":/qt/qml/Derived/qml/Blue.qml"));
+ QVERIFY(QQuickTest::showView(view, QUrl(u"qrc:/qt/qml/Derived/qml/main.qml"_qs)));
+}
+
+QTEST_MAIN(TestLinkStaticQmlModule)
+#include "main.moc"
diff --git a/tests/auto/cmake/test_qml_app_deployment/Shapes/EllipseShape/ellipseitem.cpp b/tests/auto/cmake/test_qml_app_deployment/Shapes/EllipseShape/ellipseitem.cpp
index fda229bbd8..ea99971d37 100644
--- a/tests/auto/cmake/test_qml_app_deployment/Shapes/EllipseShape/ellipseitem.cpp
+++ b/tests/auto/cmake/test_qml_app_deployment/Shapes/EllipseShape/ellipseitem.cpp
@@ -1,5 +1,5 @@
// Copyright (C) 2022 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "ellipseitem.h"
#include <QPainter>
diff --git a/tests/auto/cmake/test_qml_app_deployment/Shapes/EllipseShape/ellipseitem.h b/tests/auto/cmake/test_qml_app_deployment/Shapes/EllipseShape/ellipseitem.h
index 88ce76a641..b2aa94b3f3 100644
--- a/tests/auto/cmake/test_qml_app_deployment/Shapes/EllipseShape/ellipseitem.h
+++ b/tests/auto/cmake/test_qml_app_deployment/Shapes/EllipseShape/ellipseitem.h
@@ -1,5 +1,5 @@
// Copyright (C) 2022 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef ELLIPSEITEM_H
#define ELLIPSEITEM_H
diff --git a/tests/auto/cmake/test_qml_app_deployment/Shapes/FunkyShape/FunkyItemQml.qml b/tests/auto/cmake/test_qml_app_deployment/Shapes/FunkyShape/FunkyItemQml.qml
index 48794ff428..99af8c58fd 100644
--- a/tests/auto/cmake/test_qml_app_deployment/Shapes/FunkyShape/FunkyItemQml.qml
+++ b/tests/auto/cmake/test_qml_app_deployment/Shapes/FunkyShape/FunkyItemQml.qml
@@ -1,5 +1,5 @@
// Copyright (C) 2022 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick
import QtQuick.Shapes
diff --git a/tests/auto/cmake/test_qml_app_deployment/Shapes/FunkyShape/funkyitem.cpp b/tests/auto/cmake/test_qml_app_deployment/Shapes/FunkyShape/funkyitem.cpp
index b19232e624..3c6b2321e2 100644
--- a/tests/auto/cmake/test_qml_app_deployment/Shapes/FunkyShape/funkyitem.cpp
+++ b/tests/auto/cmake/test_qml_app_deployment/Shapes/FunkyShape/funkyitem.cpp
@@ -1,5 +1,5 @@
// Copyright (C) 2022 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "funkyitem.h"
#include <QPainter>
diff --git a/tests/auto/cmake/test_qml_app_deployment/Shapes/FunkyShape/funkyitem.h b/tests/auto/cmake/test_qml_app_deployment/Shapes/FunkyShape/funkyitem.h
index ea0338763d..6899cd41e9 100644
--- a/tests/auto/cmake/test_qml_app_deployment/Shapes/FunkyShape/funkyitem.h
+++ b/tests/auto/cmake/test_qml_app_deployment/Shapes/FunkyShape/funkyitem.h
@@ -1,5 +1,5 @@
// Copyright (C) 2022 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef FunkyItem_H
#define FunkyItem_H
diff --git a/tests/auto/cmake/test_qml_app_deployment/main.cpp b/tests/auto/cmake/test_qml_app_deployment/main.cpp
index 00ee6cf8eb..5af318ea14 100644
--- a/tests/auto/cmake/test_qml_app_deployment/main.cpp
+++ b/tests/auto/cmake/test_qml_app_deployment/main.cpp
@@ -1,5 +1,5 @@
// Copyright (C) 2022 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtQml/QQmlEngine>
#include <QtQuick/QQuickView>
#include <QtTest/QTest>
diff --git a/tests/auto/cmake/test_qml_app_deployment/main.qml b/tests/auto/cmake/test_qml_app_deployment/main.qml
index 5df35a0592..abac994370 100644
--- a/tests/auto/cmake/test_qml_app_deployment/main.qml
+++ b/tests/auto/cmake/test_qml_app_deployment/main.qml
@@ -1,5 +1,5 @@
// Copyright (C) 2022 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick
import Shapes
diff --git a/tests/auto/cmake/test_static_qml_module/CMakeLists.txt b/tests/auto/cmake/test_static_qml_module/CMakeLists.txt
new file mode 100644
index 0000000000..83d6b74daa
--- /dev/null
+++ b/tests/auto/cmake/test_static_qml_module/CMakeLists.txt
@@ -0,0 +1,38 @@
+cmake_minimum_required(VERSION 3.16)
+project(test_static_qml_module LANGUAGES CXX)
+
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml Quick Test)
+qt_standard_project_setup(REQUIRES 6.5)
+
+qt_add_executable(test_static_qml_module
+ main.cpp
+)
+
+qt_add_qml_module(test_static_qml_module
+ URI MyAppUri
+ VERSION 1.0
+ QML_FILES
+ main.qml
+ IMPORT_PATH
+ ${CMAKE_CURRENT_BINARY_DIR}/qml
+)
+
+target_link_libraries(test_static_qml_module
+ PRIVATE
+ Qt::Core
+ Qt::Gui
+ Qt::Qml
+ Qt::Quick
+ Qt::Test
+)
+
+qt_add_qml_module(test_static_qml_module_lib
+ STATIC
+ URI MyUri
+ OUTPUT_DIRECTORY qml/MyUri
+ VERSION 1.0
+ SOURCES
+ MyElement.cpp MyElement.h
+)
+
+qt_import_qml_plugins(test_static_qml_module)
diff --git a/tests/auto/cmake/test_static_qml_module/MyElement.cpp b/tests/auto/cmake/test_static_qml_module/MyElement.cpp
new file mode 100644
index 0000000000..6e3cb8cf2e
--- /dev/null
+++ b/tests/auto/cmake/test_static_qml_module/MyElement.cpp
@@ -0,0 +1,4 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "MyElement.h"
diff --git a/tests/auto/cmake/test_static_qml_module/MyElement.h b/tests/auto/cmake/test_static_qml_module/MyElement.h
new file mode 100644
index 0000000000..118606aa33
--- /dev/null
+++ b/tests/auto/cmake/test_static_qml_module/MyElement.h
@@ -0,0 +1,20 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#pragma once
+
+#include <QObject>
+#include <QtQml>
+
+class MyElement : public QObject
+{
+ Q_OBJECT
+ QML_ELEMENT
+ Q_PROPERTY(QString someProp MEMBER m_someProp)
+public:
+ MyElement() = default;
+ ~MyElement() = default;
+
+private:
+ QString m_someProp;
+};
diff --git a/tests/auto/cmake/test_static_qml_module/main.cpp b/tests/auto/cmake/test_static_qml_module/main.cpp
new file mode 100644
index 0000000000..87d690004a
--- /dev/null
+++ b/tests/auto/cmake/test_static_qml_module/main.cpp
@@ -0,0 +1,35 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include <QObject>
+#include <QString>
+#include <QTest>
+#include <QQmlEngine>
+#include <QQmlComponent>
+#include <QQmlExtensionPlugin>
+#include <QUrl>
+
+Q_IMPORT_QML_PLUGIN(MyUriPlugin)
+
+using namespace Qt::StringLiterals;
+
+class TestStaticQmlPlugin : public QObject
+{
+ Q_OBJECT
+private slots:
+ void ElementFromPluginAvailable();
+};
+
+void TestStaticQmlPlugin::ElementFromPluginAvailable()
+{
+ QQmlEngine engine;
+ engine.addImportPath(QStringLiteral(":/qt/qml"));
+ QQmlComponent c(&engine, QUrl(u"qrc:/qt/qml/MyAppUri/main.qml"_s));
+ QVERIFY2(c.isReady(), qPrintable(c.errorString()));
+ QScopedPointer<QObject> o(c.create());
+ QVERIFY(!o.isNull());
+}
+
+QTEST_MAIN(TestStaticQmlPlugin)
+
+#include "main.moc"
diff --git a/tests/auto/cmake/test_static_qml_module/main.qml b/tests/auto/cmake/test_static_qml_module/main.qml
new file mode 100644
index 0000000000..29720ebae1
--- /dev/null
+++ b/tests/auto/cmake/test_static_qml_module/main.qml
@@ -0,0 +1,7 @@
+import QtQuick
+import MyUri
+
+MyElement {
+ id: el
+ someProp: "My window title"
+}
diff --git a/tests/auto/cmake/tooling_imports/First/Neighbor.cpp b/tests/auto/cmake/tooling_imports/First/Neighbor.cpp
index d6adca4823..920394cf6e 100644
--- a/tests/auto/cmake/tooling_imports/First/Neighbor.cpp
+++ b/tests/auto/cmake/tooling_imports/First/Neighbor.cpp
@@ -1,5 +1,5 @@
// Copyright (C) 2021 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "Neighbor.h"
diff --git a/tests/auto/cmake/tooling_imports/First/Neighbor.h b/tests/auto/cmake/tooling_imports/First/Neighbor.h
index e5119bc4c4..05e18d23d7 100644
--- a/tests/auto/cmake/tooling_imports/First/Neighbor.h
+++ b/tests/auto/cmake/tooling_imports/First/Neighbor.h
@@ -1,5 +1,5 @@
// Copyright (C) 2021 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef NEIGHBOR_H
#define NEIGHBOR_H
@@ -15,4 +15,11 @@ public:
Neighbor(QObject *parent = nullptr);
};
+class Absent : public QObject
+{
+ Q_OBJECT
+ QML_ELEMENT
+ QML_UNAVAILABLE
+};
+
#endif // NEIGHBOR_H
diff --git a/tests/auto/cmake/tooling_imports/main.cpp b/tests/auto/cmake/tooling_imports/main.cpp
index a1c8dd9daf..92693a832b 100644
--- a/tests/auto/cmake/tooling_imports/main.cpp
+++ b/tests/auto/cmake/tooling_imports/main.cpp
@@ -1,5 +1,5 @@
// Copyright (C) 2021 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtCore>
#include <QtQml>