summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKai Koehne <kai.koehne@qt.io>2020-11-25 17:21:09 +0100
committerKai Koehne <kai.koehne@qt.io>2020-11-30 05:39:21 +0100
commit130b2090147e0d28e35fd736fbefcd588c0014f6 (patch)
treeb5b26a11b44809aa31d02c01d3d6bcc516348c06
parentbac73a36e25076a5929c7feac0675860772e7270 (diff)
Doc: Use explicit linkage with target_link_libraries
The Professional CMake book suggests always using explicit linkage with target_link_libraries, so let's use that. Whether to use PUBLIC or PRIVATE depends on the context. But let's be conservative and advise on using PRIVATE by default. Task-number: QTBUG-88935 Pick-to: 6.0 Change-Id: I12b80ee85be9f6916f1e4dea6b1c9cb29e03c20f Reviewed-by: Craig Scott <craig.scott@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
-rw-r--r--src/concurrent/doc/snippets/CMakeLists.txt2
-rw-r--r--src/corelib/doc/snippets/overview/using-qt-core.cmake2
-rw-r--r--src/dbus/doc/snippets/CMakeLists.txt2
-rw-r--r--src/gui/doc/snippets/overview/using-qt-gui.cmake2
-rw-r--r--src/network/doc/snippets/CMakeLists.txt2
-rw-r--r--src/opengl/doc/snippets/CMakeLists.txt2
-rw-r--r--src/printsupport/doc/snippets/CMakeLists.txt2
-rw-r--r--src/sql/doc/snippets/CMakeLists.txt2
-rw-r--r--src/testlib/doc/snippets/CMakeLists.txt2
-rw-r--r--src/widgets/doc/snippets/CMakeLists.txt2
-rw-r--r--src/xml/doc/snippets/CMakeLists.txt2
11 files changed, 11 insertions, 11 deletions
diff --git a/src/concurrent/doc/snippets/CMakeLists.txt b/src/concurrent/doc/snippets/CMakeLists.txt
index 35be339f31..ffbf3014c9 100644
--- a/src/concurrent/doc/snippets/CMakeLists.txt
+++ b/src/concurrent/doc/snippets/CMakeLists.txt
@@ -1,4 +1,4 @@
#! [cmake_use]
find_package(Qt6 COMPONENTS Concurrent REQUIRED)
-target_link_libraries(mytarget Qt6::Concurrent)
+target_link_libraries(mytarget PRIVATE Qt6::Concurrent)
#! [cmake_use]
diff --git a/src/corelib/doc/snippets/overview/using-qt-core.cmake b/src/corelib/doc/snippets/overview/using-qt-core.cmake
index b5689d803d..a2c2034b8b 100644
--- a/src/corelib/doc/snippets/overview/using-qt-core.cmake
+++ b/src/corelib/doc/snippets/overview/using-qt-core.cmake
@@ -1,2 +1,2 @@
find_package(Qt6 COMPONENTS Core REQUIRED)
-target_link_libraries(mytarget Qt6::Core)
+target_link_libraries(mytarget PRIVATE Qt6::Core)
diff --git a/src/dbus/doc/snippets/CMakeLists.txt b/src/dbus/doc/snippets/CMakeLists.txt
index 87c7990972..825a088019 100644
--- a/src/dbus/doc/snippets/CMakeLists.txt
+++ b/src/dbus/doc/snippets/CMakeLists.txt
@@ -1,4 +1,4 @@
#! [cmake_use]
find_package(Qt6 COMPONENTS DBus REQUIRED)
-target_link_libraries(mytarget Qt6::DBus)
+target_link_libraries(mytarget PRIVATE Qt6::DBus)
#! [cmake_use]
diff --git a/src/gui/doc/snippets/overview/using-qt-gui.cmake b/src/gui/doc/snippets/overview/using-qt-gui.cmake
index 687a83a2d0..65a3f9034a 100644
--- a/src/gui/doc/snippets/overview/using-qt-gui.cmake
+++ b/src/gui/doc/snippets/overview/using-qt-gui.cmake
@@ -1,2 +1,2 @@
find_package(Qt6 COMPONENTS Gui REQUIRED)
-target_link_libraries(mytarget Qt6::Gui)
+target_link_libraries(mytarget PRIVATE Qt6::Gui)
diff --git a/src/network/doc/snippets/CMakeLists.txt b/src/network/doc/snippets/CMakeLists.txt
index 2936484f19..2ae4c75a1b 100644
--- a/src/network/doc/snippets/CMakeLists.txt
+++ b/src/network/doc/snippets/CMakeLists.txt
@@ -8,5 +8,5 @@ add_executable(mytarget
# ![0]
find_package(Qt6 COMPONENTS Network REQUIRED)
-target_link_libraries(mytarget Qt6::Network)
+target_link_libraries(mytarget PRIVATE Qt6::Network)
# ![0]
diff --git a/src/opengl/doc/snippets/CMakeLists.txt b/src/opengl/doc/snippets/CMakeLists.txt
index 8ec6a4b83b..28b641adfd 100644
--- a/src/opengl/doc/snippets/CMakeLists.txt
+++ b/src/opengl/doc/snippets/CMakeLists.txt
@@ -1,4 +1,4 @@
#! [cmake_use]
find_package(Qt6 COMPONENTS OpenGL REQUIRED)
-target_link_libraries(mytarget Qt6::OpenGL)
+target_link_libraries(mytarget PRIVATE Qt6::OpenGL)
#! [cmake_use]
diff --git a/src/printsupport/doc/snippets/CMakeLists.txt b/src/printsupport/doc/snippets/CMakeLists.txt
index 6710a38db0..0a7f3b86fd 100644
--- a/src/printsupport/doc/snippets/CMakeLists.txt
+++ b/src/printsupport/doc/snippets/CMakeLists.txt
@@ -1,4 +1,4 @@
#! [cmake_use]
find_package(Qt6 COMPONENTS PrintSupport REQUIRED)
-target_link_libraries(mytarget Qt6::PrintSupport)
+target_link_libraries(mytarget PRIVATE Qt6::PrintSupport)
#! [cmake_use]
diff --git a/src/sql/doc/snippets/CMakeLists.txt b/src/sql/doc/snippets/CMakeLists.txt
index bb300f425b..2e74eed35a 100644
--- a/src/sql/doc/snippets/CMakeLists.txt
+++ b/src/sql/doc/snippets/CMakeLists.txt
@@ -1,4 +1,4 @@
#! [cmake_use]
find_package(Qt6 COMPONENTS Sql REQUIRED)
-target_link_libraries(mytarget Qt6::Sql)
+target_link_libraries(mytarget PRIVATE Qt6::Sql)
#! [cmake_use]
diff --git a/src/testlib/doc/snippets/CMakeLists.txt b/src/testlib/doc/snippets/CMakeLists.txt
index c8ba7cc47a..1dac3c91aa 100644
--- a/src/testlib/doc/snippets/CMakeLists.txt
+++ b/src/testlib/doc/snippets/CMakeLists.txt
@@ -1,4 +1,4 @@
#! [cmake_use]
find_package(Qt6 COMPONENTS Test REQUIRED)
-target_link_libraries(mytarget Qt6::Test)
+target_link_libraries(mytarget PRIVATE Qt6::Test)
#! [cmake_use]
diff --git a/src/widgets/doc/snippets/CMakeLists.txt b/src/widgets/doc/snippets/CMakeLists.txt
index 1ba55ccb3b..ebf9b38dc2 100644
--- a/src/widgets/doc/snippets/CMakeLists.txt
+++ b/src/widgets/doc/snippets/CMakeLists.txt
@@ -1,4 +1,4 @@
#! [cmake_use]
find_package(Qt6 COMPONENTS Widgets REQUIRED)
-target_link_libraries(mytarget Qt6::Widgets)
+target_link_libraries(mytarget PRIVATE Qt6::Widgets)
#! [cmake_use]
diff --git a/src/xml/doc/snippets/CMakeLists.txt b/src/xml/doc/snippets/CMakeLists.txt
index 18b7eaf266..134f6c2589 100644
--- a/src/xml/doc/snippets/CMakeLists.txt
+++ b/src/xml/doc/snippets/CMakeLists.txt
@@ -1,4 +1,4 @@
#! [cmake_use]
find_package(Qt6 COMPONENTS Xml REQUIRED)
-target_link_libraries(mytarget Qt6::Xml)
+target_link_libraries(mytarget PRIVATE Qt6::Xml)
#! [cmake_use]