summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKai Köhne <kai.koehne@qt.io>2021-12-10 09:20:24 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-12-17 12:50:18 +0000
commitc4b4a679237ffce0a473aad865ad04f7b41fe071 (patch)
treeea0a6488f1acd90c5fc024c889b05e50871f9dec
parent410da09b9c096cf5a2dec6e64ee26114e251ecea (diff)
downloadqtdoc-c4b4a679237ffce0a473aad865ad04f7b41fe071.tar.gz
Doc: Use find_package(Qt6 REQUIRED COMPONENTS ...) idiom
Using REQUIRED as a prefix instead of suffix works better with OPTIONAL_COMPONENTS, and is also the order in the CMake manual. Task-number: QTBUG-98867 Change-Id: I7ba13e267f96bb9553814651f1f6c3c3f270967e Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 489f4eec458ee1873795044c86a0499c554ecabe) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--doc/src/cmake/snippets/cmake/examples.cmake2
-rw-r--r--doc/src/cmake/snippets/cmake/helloworld_qtwidgets.cmake2
-rw-r--r--doc/src/cmake/snippets/cmake/qt5_qt6_compatible.cmake6
3 files changed, 5 insertions, 5 deletions
diff --git a/doc/src/cmake/snippets/cmake/examples.cmake b/doc/src/cmake/snippets/cmake/examples.cmake
index 4def3e1a..2ee14924 100644
--- a/doc/src/cmake/snippets/cmake/examples.cmake
+++ b/doc/src/cmake/snippets/cmake/examples.cmake
@@ -1,5 +1,5 @@
#! [2]
-find_package(Qt6 COMPONENTS Core REQUIRED)
+find_package(Qt6 REQUIRED COMPONENTS Core)
set(CMAKE_CXX_FLAGS_COVERAGE "${CMAKE_CXX_FLAGS_RELEASE} -fprofile-arcs -ftest-coverage")
diff --git a/doc/src/cmake/snippets/cmake/helloworld_qtwidgets.cmake b/doc/src/cmake/snippets/cmake/helloworld_qtwidgets.cmake
index 2c2e7373..0e38762a 100644
--- a/doc/src/cmake/snippets/cmake/helloworld_qtwidgets.cmake
+++ b/doc/src/cmake/snippets/cmake/helloworld_qtwidgets.cmake
@@ -9,7 +9,7 @@ set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
-find_package(Qt6 COMPONENTS Widgets REQUIRED)
+find_package(Qt6 REQUIRED COMPONENTS Widgets)
add_executable(helloworld
mainwindow.ui
diff --git a/doc/src/cmake/snippets/cmake/qt5_qt6_compatible.cmake b/doc/src/cmake/snippets/cmake/qt5_qt6_compatible.cmake
index 09c033d8..aa693803 100644
--- a/doc/src/cmake/snippets/cmake/qt5_qt6_compatible.cmake
+++ b/doc/src/cmake/snippets/cmake/qt5_qt6_compatible.cmake
@@ -1,7 +1,7 @@
#! [versionless_targets]
find_package(Qt6 COMPONENTS Widgets)
if (NOT Qt6_FOUND)
- find_package(Qt5 5.15 COMPONENTS Core REQUIRED)
+ find_package(Qt5 5.15 REQUIRED COMPONENTS Core)
add_executable(helloworld
...
@@ -11,8 +11,8 @@ target_link_libraries(helloworld PRIVATE Qt::Core)
#! [versionless_targets]
#! [older_qt_versions]
-find_package(QT NAMES Qt6 Qt5 COMPONENTS Core REQUIRED)
-find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core REQUIRED)
+find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core)
+find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core)
add_executable(helloworld
...