Skip to content

Commit

Permalink
Examples: Use find_package(Qt6 REQUIRED COMPONENTS ...) idiom
Browse files Browse the repository at this point in the history
Also consolidate several find_package(Qt6 ...) calls in one call.

Task-number: QTBUG-98867
Change-Id: Idfd5e71f46d4489fac7411cbfadb84437a0658f3
Reviewed-by: Alexey Edelev <[email protected]>
Reviewed-by: Edward Welbourne <[email protected]>
  • Loading branch information
kkoehne committed Dec 10, 2021
1 parent 0800947 commit 7024e7a
Show file tree
Hide file tree
Showing 238 changed files with 268 additions and 755 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ endif()

set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/corelib/bindableproperties/bindablesubscription")

find_package(Qt6 COMPONENTS Core)
find_package(Qt6 COMPONENTS Gui)
find_package(Qt6 COMPONENTS Widgets)
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)

qt_add_executable(bindablesubscription
../shared/subscriptionwindow.cpp ../shared/subscriptionwindow.h ../shared/subscriptionwindow.ui
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ endif()

set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/corelib/bindableproperties/subscription")

find_package(Qt6 COMPONENTS Core)
find_package(Qt6 COMPONENTS Gui)
find_package(Qt6 COMPONENTS Widgets)
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)

qt_add_executable(subscription
../shared/subscriptionwindow.cpp ../shared/subscriptionwindow.h ../shared/subscriptionwindow.ui
Expand Down
5 changes: 1 addition & 4 deletions examples/corelib/ipc/localfortuneclient/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@ endif()

set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/corelib/ipc/localfortuneclient")

find_package(Qt6 COMPONENTS Core)
find_package(Qt6 COMPONENTS Gui)
find_package(Qt6 COMPONENTS Network)
find_package(Qt6 COMPONENTS Widgets)
find_package(Qt6 REQUIRED COMPONENTS Core Gui Network Widgets)

qt_add_executable(localfortuneclient
client.cpp client.h
Expand Down
5 changes: 1 addition & 4 deletions examples/corelib/ipc/localfortuneserver/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@ endif()

set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/corelib/ipc/localfortuneserver")

find_package(Qt6 COMPONENTS Core)
find_package(Qt6 COMPONENTS Gui)
find_package(Qt6 COMPONENTS Network)
find_package(Qt6 COMPONENTS Widgets)
find_package(Qt6 REQUIRED COMPONENTS Core Gui Network Widgets)

qt_add_executable(localfortuneserver
main.cpp
Expand Down
4 changes: 1 addition & 3 deletions examples/corelib/ipc/sharedmemory/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ endif()

set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/corelib/ipc/sharedmemory")

find_package(Qt6 COMPONENTS Core)
find_package(Qt6 COMPONENTS Gui)
find_package(Qt6 COMPONENTS Widgets)
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)

qt_add_executable(sharedmemory
dialog.cpp dialog.h dialog.ui
Expand Down
4 changes: 1 addition & 3 deletions examples/corelib/mimetypes/mimetypebrowser/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ endif()

set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/corelib/mimetypes/mimetypebrowser")

find_package(Qt6 COMPONENTS Core)
find_package(Qt6 COMPONENTS Gui)
find_package(Qt6 COMPONENTS Widgets)
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)

qt_add_executable(mimetypebrowser
main.cpp
Expand Down
2 changes: 1 addition & 1 deletion examples/corelib/platform/androidnotifier/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()

find_package(Qt6 COMPONENTS Widgets REQUIRED)
find_package(Qt6 REQUIRED COMPONENTS Widgets)

set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/corelib/platform/androidnotifier")

Expand Down
2 changes: 1 addition & 1 deletion examples/corelib/serialization/cbordump/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ endif()

set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/corelib/serialization/cbordump")

find_package(Qt6 COMPONENTS Core)
find_package(Qt6 REQUIRED COMPONENTS Core)

qt_add_executable(cbordump
main.cpp
Expand Down
2 changes: 1 addition & 1 deletion examples/corelib/serialization/convert/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ endif()

set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/corelib/serialization/convert")

find_package(Qt6 COMPONENTS Core)
find_package(Qt6 REQUIRED COMPONENTS Core)

qt_add_executable(convert
cborconverter.cpp cborconverter.h
Expand Down
2 changes: 1 addition & 1 deletion examples/corelib/serialization/savegame/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ endif()

set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/corelib/serialization/savegame")

find_package(Qt6 COMPONENTS Core)
find_package(Qt6 REQUIRED COMPONENTS Core)

qt_add_executable(savegame
character.cpp character.h
Expand Down
4 changes: 1 addition & 3 deletions examples/corelib/threads/mandelbrot/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ endif()

set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/corelib/threads/mandelbrot")

find_package(Qt6 COMPONENTS Core)
find_package(Qt6 COMPONENTS Gui)
find_package(Qt6 COMPONENTS Widgets)
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)

qt_add_executable(mandelbrot
main.cpp
Expand Down
4 changes: 1 addition & 3 deletions examples/corelib/threads/queuedcustomtype/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ endif()

set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/corelib/threads/queuedcustomtype")

find_package(Qt6 COMPONENTS Core)
find_package(Qt6 COMPONENTS Gui)
find_package(Qt6 COMPONENTS Widgets)
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)

qt_add_executable(queuedcustomtype
block.cpp block.h
Expand Down
2 changes: 1 addition & 1 deletion examples/corelib/threads/semaphores/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ endif()

set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/corelib/threads/semaphores")

find_package(Qt6 COMPONENTS Core)
find_package(Qt6 REQUIRED COMPONENTS Core)

qt_add_executable(semaphores
semaphores.cpp
Expand Down
2 changes: 1 addition & 1 deletion examples/corelib/threads/waitconditions/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ endif()

set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/corelib/threads/waitconditions")

find_package(Qt6 COMPONENTS Core)
find_package(Qt6 REQUIRED COMPONENTS Core)

qt_add_executable(waitconditions
waitconditions.cpp
Expand Down
4 changes: 1 addition & 3 deletions examples/corelib/tools/contiguouscache/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ endif()

set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/corelib/tools/contiguouscache")

find_package(Qt6 COMPONENTS Core)
find_package(Qt6 COMPONENTS Gui)
find_package(Qt6 COMPONENTS Widgets)
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)

qt_add_executable(contiguouscache
main.cpp
Expand Down
4 changes: 1 addition & 3 deletions examples/corelib/tools/customtype/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ endif()

set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/corelib/tools/customtype")

find_package(Qt6 COMPONENTS Core)
find_package(Qt6 COMPONENTS Gui)
find_package(Qt6 COMPONENTS Widgets)
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)

qt_add_executable(customtype
main.cpp
Expand Down
4 changes: 1 addition & 3 deletions examples/corelib/tools/customtypesending/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ endif()

set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/corelib/tools/customtypesending")

find_package(Qt6 COMPONENTS Core)
find_package(Qt6 COMPONENTS Gui)
find_package(Qt6 COMPONENTS Widgets)
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)

qt_add_executable(customtypesending
main.cpp
Expand Down
5 changes: 1 addition & 4 deletions examples/dbus/chat/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@ endif()

set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/dbus/chat")

find_package(Qt6 COMPONENTS Core)
find_package(Qt6 COMPONENTS Gui)
find_package(Qt6 COMPONENTS DBus)
find_package(Qt6 COMPONENTS Widgets)
find_package(Qt6 REQUIRED COMPONENTS Core DBus Gui Widgets)

# special case begin
set(chat_SRCS)
Expand Down
2 changes: 1 addition & 1 deletion examples/dbus/complexpingpong/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ endif()

set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/dbus/complexpingpong")

find_package(Qt6 COMPONENTS Core DBus)
find_package(Qt6 REQUIRED COMPONENTS Core DBus)

qt_add_executable(complexping
complexping.cpp complexping.h
Expand Down
3 changes: 1 addition & 2 deletions examples/dbus/listnames/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ endif()

set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/dbus/listnames")

find_package(Qt6 COMPONENTS Core)
find_package(Qt6 COMPONENTS DBus)
find_package(Qt6 REQUIRED COMPONENTS Core DBus)

qt_add_executable(listnames
listnames.cpp
Expand Down
2 changes: 1 addition & 1 deletion examples/dbus/pingpong/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ endif()

set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/dbus/pingpong")

find_package(Qt6 COMPONENTS Core DBus)
find_package(Qt6 REQUIRED COMPONENTS Core DBus)

qt_add_executable(ping
ping.cpp
Expand Down
5 changes: 1 addition & 4 deletions examples/dbus/remotecontrolledcar/car/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@ endif()

set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/dbus/remotecontrolledcar/car")

find_package(Qt6 COMPONENTS Core)
find_package(Qt6 COMPONENTS Gui)
find_package(Qt6 COMPONENTS DBus)
find_package(Qt6 COMPONENTS Widgets)
find_package(Qt6 REQUIRED COMPONENTS Core DBus Gui Widgets)

# special case begin
set(car_SRCS)
Expand Down
5 changes: 1 addition & 4 deletions examples/dbus/remotecontrolledcar/controller/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@ endif()

set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/dbus/remotecontrolledcar/controller")

find_package(Qt6 COMPONENTS Core)
find_package(Qt6 COMPONENTS Gui)
find_package(Qt6 COMPONENTS DBus)
find_package(Qt6 COMPONENTS Widgets)
find_package(Qt6 REQUIRED COMPONENTS Core DBus Gui Widgets)

# special case begin
set(controller_SRCS)
Expand Down
4 changes: 1 addition & 3 deletions examples/embedded/digiflip/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ endif()

set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/embedded/digiflip")

find_package(Qt6 COMPONENTS Core)
find_package(Qt6 COMPONENTS Gui)
find_package(Qt6 COMPONENTS Widgets)
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)

qt_add_executable(digiflip
digiflip.cpp
Expand Down
4 changes: 1 addition & 3 deletions examples/embedded/flickable/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ endif()

set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/embedded/flickable")

find_package(Qt6 COMPONENTS Core)
find_package(Qt6 COMPONENTS Gui)
find_package(Qt6 COMPONENTS Widgets)
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)

qt_add_executable(flickable
flickable.cpp flickable.h
Expand Down
5 changes: 1 addition & 4 deletions examples/embedded/flightinfo/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@ endif()

set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/embedded/flightinfo")

find_package(Qt6 COMPONENTS Core)
find_package(Qt6 COMPONENTS Gui)
find_package(Qt6 COMPONENTS Network)
find_package(Qt6 COMPONENTS Widgets)
find_package(Qt6 REQUIRED COMPONENTS Core Gui Network Widgets)

qt_add_executable(flightinfo
flightinfo.cpp
Expand Down
5 changes: 1 addition & 4 deletions examples/embedded/lightmaps/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@ endif()

set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/embedded/lightmaps")

find_package(Qt6 COMPONENTS Core)
find_package(Qt6 COMPONENTS Gui)
find_package(Qt6 COMPONENTS Network)
find_package(Qt6 COMPONENTS Widgets)
find_package(Qt6 REQUIRED COMPONENTS Core Gui Network Widgets)

qt_add_executable(lightmaps
lightmaps.cpp lightmaps.h
Expand Down
4 changes: 1 addition & 3 deletions examples/embedded/raycasting/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ endif()

set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/embedded/raycasting")

find_package(Qt6 COMPONENTS Core)
find_package(Qt6 COMPONENTS Gui)
find_package(Qt6 COMPONENTS Widgets)
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)

qt_add_executable(raycasting
raycasting.cpp
Expand Down
4 changes: 1 addition & 3 deletions examples/embedded/styleexample/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ endif()

set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/embedded/styleexample")

find_package(Qt6 COMPONENTS Core)
find_package(Qt6 COMPONENTS Gui)
find_package(Qt6 COMPONENTS Widgets)
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)

qt_add_executable(styleexample
main.cpp
Expand Down
4 changes: 1 addition & 3 deletions examples/gui/analogclock/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ endif()

set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/gui/gui_analogclock") # special case

find_package(Qt6 COMPONENTS Core)
find_package(Qt6 COMPONENTS Gui)
find_package(Qt6 COMPONENTS Widgets) # special case: add
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)

qt_add_executable(gui_analogclock # special case: renamed target
../rasterwindow/rasterwindow.cpp ../rasterwindow/rasterwindow.h
Expand Down
3 changes: 1 addition & 2 deletions examples/gui/rasterwindow/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ endif()

set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/gui/rasterwindow")

find_package(Qt6 COMPONENTS Core)
find_package(Qt6 COMPONENTS Gui)
find_package(Qt6 REQUIRED COMPONENTS Core Gui)

qt_add_executable(rasterwindow
main.cpp
Expand Down
5 changes: 1 addition & 4 deletions examples/network/blockingfortuneclient/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@ endif()

set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/network/blockingfortuneclient")

find_package(Qt6 COMPONENTS Core)
find_package(Qt6 COMPONENTS Gui)
find_package(Qt6 COMPONENTS Network)
find_package(Qt6 COMPONENTS Widgets)
find_package(Qt6 REQUIRED COMPONENTS Core Gui Network Widgets)

qt_add_executable(blockingfortuneclient
blockingclient.cpp blockingclient.h
Expand Down
5 changes: 1 addition & 4 deletions examples/network/broadcastreceiver/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@ endif()

set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/network/broadcastreceiver")

find_package(Qt6 COMPONENTS Core)
find_package(Qt6 COMPONENTS Gui)
find_package(Qt6 COMPONENTS Network)
find_package(Qt6 COMPONENTS Widgets)
find_package(Qt6 REQUIRED COMPONENTS Core Gui Network Widgets)

qt_add_executable(broadcastreceiver
main.cpp
Expand Down
5 changes: 1 addition & 4 deletions examples/network/broadcastsender/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@ endif()

set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/network/broadcastsender")

find_package(Qt6 COMPONENTS Core)
find_package(Qt6 COMPONENTS Gui)
find_package(Qt6 COMPONENTS Network)
find_package(Qt6 COMPONENTS Widgets)
find_package(Qt6 REQUIRED COMPONENTS Core Gui Network Widgets)

qt_add_executable(broadcastsender
main.cpp
Expand Down
3 changes: 1 addition & 2 deletions examples/network/dnslookup/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ endif()

set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/network/dnslookup")

find_package(Qt6 COMPONENTS Core)
find_package(Qt6 COMPONENTS Network)
find_package(Qt6 REQUIRED COMPONENTS Core Network)

qt_add_executable(dnslookup
dnslookup.cpp dnslookup.h
Expand Down
3 changes: 1 addition & 2 deletions examples/network/download/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ endif()

set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/network/download")

find_package(Qt6 COMPONENTS Core)
find_package(Qt6 COMPONENTS Network)
find_package(Qt6 REQUIRED COMPONENTS Core Network)

qt_add_executable(download
main.cpp
Expand Down
3 changes: 1 addition & 2 deletions examples/network/downloadmanager/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ endif()

set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/network/downloadmanager")

find_package(Qt6 COMPONENTS Core)
find_package(Qt6 COMPONENTS Network)
find_package(Qt6 REQUIRED COMPONENTS Core Network)

qt_add_executable(downloadmanager
downloadmanager.cpp downloadmanager.h
Expand Down
Loading

0 comments on commit 7024e7a

Please sign in to comment.