summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2023-01-25 15:16:31 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2023-01-26 09:55:56 +0000
commit7d960b07a43fcb4cc5235e10a35471aa5d6d71b0 (patch)
treeaaf671c50c3771f6ffb0167b517ca1e245dffb20
parent99e17d69cd58b6b37dc1ed5ba2b5e120816fdea1 (diff)
downloadqtdoc-7d960b07a43fcb4cc5235e10a35471aa5d6d71b0.tar.gz
Add toplevel CMake file for "Building re-usable QML modules"
Fixes: QTBUG-105362 Change-Id: I174830599353869119dc7de46e8667bcd37978fd Reviewed-by: Sami Shalayel <sami.shalayel@qt.io> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> (cherry picked from commit 15dc2ee97b5f048748722f49e2d77651f8c2d90d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--doc/src/cmake/cmake-manual.qdoc9
-rw-r--r--doc/src/cmake/snippets/cmake/helloworld_subdirs_qml_toplevel.cmake14
2 files changed, 21 insertions, 2 deletions
diff --git a/doc/src/cmake/cmake-manual.qdoc b/doc/src/cmake/cmake-manual.qdoc
index d70164e1..02265978 100644
--- a/doc/src/cmake/cmake-manual.qdoc
+++ b/doc/src/cmake/cmake-manual.qdoc
@@ -519,8 +519,13 @@
├── mytype.h
\endcode
- The toplevel \c CMakeLists.txt file does some basic setup, and then uses
- \c add_subdirectory to include the one in mylib. The subdirectory structure
+ The toplevel \c CMakeLists.txt file does some basic setup using
+ \l{qt6_standard_project_setup}{qt_standard_project_setup}, and then uses
+ \c add_subdirectory to include the one in mylib:
+
+ \quotefile snippets/cmake/helloworld_subdirs_qml_toplevel.cmake
+
+ The subdirectory structure
corresponds to the QML module’s URI, but with the dots replaced by
slashes. That’s the same logic the engine uses when it searches for a
module in the \l{Import Statements}{import paths}. \c mytype.h declares a
diff --git a/doc/src/cmake/snippets/cmake/helloworld_subdirs_qml_toplevel.cmake b/doc/src/cmake/snippets/cmake/helloworld_subdirs_qml_toplevel.cmake
new file mode 100644
index 00000000..db05176a
--- /dev/null
+++ b/doc/src/cmake/snippets/cmake/helloworld_subdirs_qml_toplevel.cmake
@@ -0,0 +1,14 @@
+# Copyright (C) 2023 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+cmake_minimum_required(VERSION 3.16)
+
+project(qmlmodule VERSION 1.0.0 LANGUAGES CXX)
+
+set(CMAKE_CXX_STANDARD 17)
+set(CMAKE_CXX_STANDARD_REQUIRED ON)
+
+find_package(Qt6 REQUIRED COMPONENTS Qml)
+qt_standard_project_setup()
+
+add_subdirectory(example/mylib)