From 6732fa3a291e77acad3ab6ba829d1026462dc139 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Tue, 11 Jun 2019 15:46:31 +0200 Subject: Fix linking of examples Provide add_qt_gui_executable() as function in our public API that takes care of automaticWinMain linkage. We can use this in the future to encapsulate similarplatform-specific behavior and adjustments, such as module generation onAndroid. In order for the examples to see the function in Qt5CoreMacros, three more additional fixes were required: * Do the build_repo_end() call _before_ attempting to build the examples, as we need the build_repo_end() to include QtPostProcess and complete the creation of all the target config files. Otherwise the find_package() calls in the examples see something incomplete. * Add more QT_NO_CREATE_TARGET guards * Always call find_dependency on the dependencies, regardless of the target creation mode. This way a find_package(Qt5 COMPONENTS Widgets) will still load Qt5CoreMacros. Change-Id: I03ce856e2f4312a050fe8043b8331cbe8a6c93e6 Reviewed-by: Qt CMake Build Bot Reviewed-by: Leander Beernaert Reviewed-by: Alexandru Croitor --- examples/network/blockingfortuneclient/CMakeLists.txt | 2 +- examples/network/broadcastreceiver/CMakeLists.txt | 2 +- examples/network/broadcastsender/CMakeLists.txt | 2 +- examples/network/fortuneclient/CMakeLists.txt | 2 +- examples/network/fortuneserver/CMakeLists.txt | 2 +- examples/network/googlesuggest/CMakeLists.txt | 2 +- examples/network/http/CMakeLists.txt | 2 +- examples/network/loopback/CMakeLists.txt | 2 +- examples/network/multicastreceiver/CMakeLists.txt | 2 +- examples/network/multicastsender/CMakeLists.txt | 2 +- examples/network/multistreamclient/CMakeLists.txt | 2 +- examples/network/multistreamserver/CMakeLists.txt | 2 +- examples/network/network-chat/CMakeLists.txt | 2 +- examples/network/securesocketclient/CMakeLists.txt | 2 +- examples/network/secureudpclient/CMakeLists.txt | 2 +- examples/network/secureudpserver/CMakeLists.txt | 2 +- examples/network/threadedfortuneserver/CMakeLists.txt | 2 +- examples/network/torrent/.prev_CMakeLists.txt | 2 +- examples/network/torrent/CMakeLists.txt | 2 +- 19 files changed, 19 insertions(+), 19 deletions(-) (limited to 'examples/network') diff --git a/examples/network/blockingfortuneclient/CMakeLists.txt b/examples/network/blockingfortuneclient/CMakeLists.txt index 603c7d9fd2..47933d66ff 100644 --- a/examples/network/blockingfortuneclient/CMakeLists.txt +++ b/examples/network/blockingfortuneclient/CMakeLists.txt @@ -14,7 +14,7 @@ set(INSTALL_EXAMPLEDIR "examples") find_package(Qt5 COMPONENTS Network) find_package(Qt5 COMPONENTS Widgets) -add_executable(blockingfortuneclient WIN32 MACOSX_BUNDLE +add_qt_gui_executable(blockingfortuneclient WIN32 MACOSX_BUNDLE blockingclient.cpp blockingclient.h fortunethread.cpp fortunethread.h main.cpp diff --git a/examples/network/broadcastreceiver/CMakeLists.txt b/examples/network/broadcastreceiver/CMakeLists.txt index 79075f3558..d8cdae0b42 100644 --- a/examples/network/broadcastreceiver/CMakeLists.txt +++ b/examples/network/broadcastreceiver/CMakeLists.txt @@ -14,7 +14,7 @@ set(INSTALL_EXAMPLEDIR "examples") find_package(Qt5 COMPONENTS Network) find_package(Qt5 COMPONENTS Widgets) -add_executable(broadcastreceiver WIN32 MACOSX_BUNDLE +add_qt_gui_executable(broadcastreceiver WIN32 MACOSX_BUNDLE main.cpp receiver.cpp receiver.h ) diff --git a/examples/network/broadcastsender/CMakeLists.txt b/examples/network/broadcastsender/CMakeLists.txt index f6da1a5733..31681c29c3 100644 --- a/examples/network/broadcastsender/CMakeLists.txt +++ b/examples/network/broadcastsender/CMakeLists.txt @@ -14,7 +14,7 @@ set(INSTALL_EXAMPLEDIR "examples") find_package(Qt5 COMPONENTS Network) find_package(Qt5 COMPONENTS Widgets) -add_executable(broadcastsender WIN32 MACOSX_BUNDLE +add_qt_gui_executable(broadcastsender WIN32 MACOSX_BUNDLE main.cpp sender.cpp sender.h ) diff --git a/examples/network/fortuneclient/CMakeLists.txt b/examples/network/fortuneclient/CMakeLists.txt index a9e0e00c7e..6530cdcf00 100644 --- a/examples/network/fortuneclient/CMakeLists.txt +++ b/examples/network/fortuneclient/CMakeLists.txt @@ -14,7 +14,7 @@ set(INSTALL_EXAMPLEDIR "examples") find_package(Qt5 COMPONENTS Network) find_package(Qt5 COMPONENTS Widgets) -add_executable(fortuneclient WIN32 MACOSX_BUNDLE +add_qt_gui_executable(fortuneclient WIN32 MACOSX_BUNDLE client.cpp client.h main.cpp ) diff --git a/examples/network/fortuneserver/CMakeLists.txt b/examples/network/fortuneserver/CMakeLists.txt index 03604f121e..43ca6f7d2b 100644 --- a/examples/network/fortuneserver/CMakeLists.txt +++ b/examples/network/fortuneserver/CMakeLists.txt @@ -14,7 +14,7 @@ set(INSTALL_EXAMPLEDIR "examples") find_package(Qt5 COMPONENTS Network) find_package(Qt5 COMPONENTS Widgets) -add_executable(fortuneserver WIN32 MACOSX_BUNDLE +add_qt_gui_executable(fortuneserver WIN32 MACOSX_BUNDLE main.cpp server.cpp server.h ) diff --git a/examples/network/googlesuggest/CMakeLists.txt b/examples/network/googlesuggest/CMakeLists.txt index d445bf646d..b1556de464 100644 --- a/examples/network/googlesuggest/CMakeLists.txt +++ b/examples/network/googlesuggest/CMakeLists.txt @@ -14,7 +14,7 @@ set(INSTALL_EXAMPLEDIR "examples") find_package(Qt5 COMPONENTS Network) find_package(Qt5 COMPONENTS Widgets) -add_executable(googlesuggest WIN32 MACOSX_BUNDLE +add_qt_gui_executable(googlesuggest WIN32 MACOSX_BUNDLE googlesuggest.cpp googlesuggest.h main.cpp searchbox.cpp searchbox.h diff --git a/examples/network/http/CMakeLists.txt b/examples/network/http/CMakeLists.txt index 931c834eae..3da3b8c3ac 100644 --- a/examples/network/http/CMakeLists.txt +++ b/examples/network/http/CMakeLists.txt @@ -14,7 +14,7 @@ set(INSTALL_EXAMPLEDIR "examples") find_package(Qt5 COMPONENTS Network) find_package(Qt5 COMPONENTS Widgets) -add_executable(http WIN32 MACOSX_BUNDLE +add_qt_gui_executable(http WIN32 MACOSX_BUNDLE authenticationdialog.ui httpwindow.cpp httpwindow.h main.cpp diff --git a/examples/network/loopback/CMakeLists.txt b/examples/network/loopback/CMakeLists.txt index 06410c7b5c..e6f46b0933 100644 --- a/examples/network/loopback/CMakeLists.txt +++ b/examples/network/loopback/CMakeLists.txt @@ -14,7 +14,7 @@ set(INSTALL_EXAMPLEDIR "examples") find_package(Qt5 COMPONENTS Network) find_package(Qt5 COMPONENTS Widgets) -add_executable(loopback WIN32 MACOSX_BUNDLE +add_qt_gui_executable(loopback WIN32 MACOSX_BUNDLE dialog.cpp dialog.h main.cpp ) diff --git a/examples/network/multicastreceiver/CMakeLists.txt b/examples/network/multicastreceiver/CMakeLists.txt index 71bcadc253..eaabf8a5d5 100644 --- a/examples/network/multicastreceiver/CMakeLists.txt +++ b/examples/network/multicastreceiver/CMakeLists.txt @@ -14,7 +14,7 @@ set(INSTALL_EXAMPLEDIR "examples") find_package(Qt5 COMPONENTS Network) find_package(Qt5 COMPONENTS Widgets) -add_executable(multicastreceiver WIN32 MACOSX_BUNDLE +add_qt_gui_executable(multicastreceiver WIN32 MACOSX_BUNDLE main.cpp receiver.cpp receiver.h ) diff --git a/examples/network/multicastsender/CMakeLists.txt b/examples/network/multicastsender/CMakeLists.txt index bcb2370649..8504bc3647 100644 --- a/examples/network/multicastsender/CMakeLists.txt +++ b/examples/network/multicastsender/CMakeLists.txt @@ -14,7 +14,7 @@ set(INSTALL_EXAMPLEDIR "examples") find_package(Qt5 COMPONENTS Network) find_package(Qt5 COMPONENTS Widgets) -add_executable(multicastsender WIN32 MACOSX_BUNDLE +add_qt_gui_executable(multicastsender WIN32 MACOSX_BUNDLE main.cpp sender.cpp sender.h ) diff --git a/examples/network/multistreamclient/CMakeLists.txt b/examples/network/multistreamclient/CMakeLists.txt index 399333fd29..c0091d1046 100644 --- a/examples/network/multistreamclient/CMakeLists.txt +++ b/examples/network/multistreamclient/CMakeLists.txt @@ -14,7 +14,7 @@ set(INSTALL_EXAMPLEDIR "examples") find_package(Qt5 COMPONENTS Network) find_package(Qt5 COMPONENTS Widgets) -add_executable(multistreamclient WIN32 MACOSX_BUNDLE +add_qt_gui_executable(multistreamclient WIN32 MACOSX_BUNDLE chatconsumer.cpp chatconsumer.h client.cpp client.h consumer.h diff --git a/examples/network/multistreamserver/CMakeLists.txt b/examples/network/multistreamserver/CMakeLists.txt index bf48042f58..44c36e4322 100644 --- a/examples/network/multistreamserver/CMakeLists.txt +++ b/examples/network/multistreamserver/CMakeLists.txt @@ -14,7 +14,7 @@ set(INSTALL_EXAMPLEDIR "examples") find_package(Qt5 COMPONENTS Network) find_package(Qt5 COMPONENTS Widgets) -add_executable(multistreamserver WIN32 MACOSX_BUNDLE +add_qt_gui_executable(multistreamserver WIN32 MACOSX_BUNDLE chatprovider.cpp chatprovider.h main.cpp movieprovider.cpp movieprovider.h diff --git a/examples/network/network-chat/CMakeLists.txt b/examples/network/network-chat/CMakeLists.txt index a4fb950370..be60e01f14 100644 --- a/examples/network/network-chat/CMakeLists.txt +++ b/examples/network/network-chat/CMakeLists.txt @@ -14,7 +14,7 @@ set(INSTALL_EXAMPLEDIR "examples") find_package(Qt5 COMPONENTS Network) find_package(Qt5 COMPONENTS Widgets) -add_executable(network-chat WIN32 MACOSX_BUNDLE +add_qt_gui_executable(network-chat WIN32 MACOSX_BUNDLE chatdialog.cpp chatdialog.h chatdialog.ui client.cpp client.h connection.cpp connection.h diff --git a/examples/network/securesocketclient/CMakeLists.txt b/examples/network/securesocketclient/CMakeLists.txt index d112af044a..f00d138d80 100644 --- a/examples/network/securesocketclient/CMakeLists.txt +++ b/examples/network/securesocketclient/CMakeLists.txt @@ -14,7 +14,7 @@ set(INSTALL_EXAMPLEDIR "examples") find_package(Qt5 COMPONENTS Network) find_package(Qt5 COMPONENTS Widgets) -add_executable(securesocketclient WIN32 MACOSX_BUNDLE +add_qt_gui_executable(securesocketclient WIN32 MACOSX_BUNDLE certificateinfo.cpp certificateinfo.h certificateinfo.ui main.cpp securesocketclient.qrc diff --git a/examples/network/secureudpclient/CMakeLists.txt b/examples/network/secureudpclient/CMakeLists.txt index 531b1196a3..6af110c412 100644 --- a/examples/network/secureudpclient/CMakeLists.txt +++ b/examples/network/secureudpclient/CMakeLists.txt @@ -14,7 +14,7 @@ set(INSTALL_EXAMPLEDIR "examples") find_package(Qt5 COMPONENTS Widgets) find_package(Qt5 COMPONENTS Network) -add_executable(secureudpclient WIN32 MACOSX_BUNDLE +add_qt_gui_executable(secureudpclient WIN32 MACOSX_BUNDLE addressdialog.cpp addressdialog.h addressdialog.ui association.cpp association.h main.cpp diff --git a/examples/network/secureudpserver/CMakeLists.txt b/examples/network/secureudpserver/CMakeLists.txt index e6e60711d0..f30d880800 100644 --- a/examples/network/secureudpserver/CMakeLists.txt +++ b/examples/network/secureudpserver/CMakeLists.txt @@ -14,7 +14,7 @@ set(INSTALL_EXAMPLEDIR "examples") find_package(Qt5 COMPONENTS Widgets) find_package(Qt5 COMPONENTS Network) -add_executable(secureudpserver WIN32 MACOSX_BUNDLE +add_qt_gui_executable(secureudpserver WIN32 MACOSX_BUNDLE main.cpp mainwindow.cpp mainwindow.h mainwindow.ui nicselector.cpp nicselector.h nicselector.ui diff --git a/examples/network/threadedfortuneserver/CMakeLists.txt b/examples/network/threadedfortuneserver/CMakeLists.txt index 43b95e60d5..ce5c0e0d19 100644 --- a/examples/network/threadedfortuneserver/CMakeLists.txt +++ b/examples/network/threadedfortuneserver/CMakeLists.txt @@ -14,7 +14,7 @@ set(INSTALL_EXAMPLEDIR "examples") find_package(Qt5 COMPONENTS Network) find_package(Qt5 COMPONENTS Widgets) -add_executable(threadedfortuneserver WIN32 MACOSX_BUNDLE +add_qt_gui_executable(threadedfortuneserver WIN32 MACOSX_BUNDLE dialog.cpp dialog.h fortuneserver.cpp fortuneserver.h fortunethread.cpp fortunethread.h diff --git a/examples/network/torrent/.prev_CMakeLists.txt b/examples/network/torrent/.prev_CMakeLists.txt index 8391a0a9db..3673b7e05a 100644 --- a/examples/network/torrent/.prev_CMakeLists.txt +++ b/examples/network/torrent/.prev_CMakeLists.txt @@ -14,7 +14,7 @@ set(INSTALL_EXAMPLEDIR "examples") find_package(Qt5 COMPONENTS Network) find_package(Qt5 COMPONENTS Widgets) -add_executable(torrent WIN32 MACOSX_BUNDLE +add_qt_gui_executable(torrent WIN32 MACOSX_BUNDLE addtorrentdialog.cpp addtorrentdialog.h bencodeparser.cpp bencodeparser.h connectionmanager.cpp connectionmanager.h diff --git a/examples/network/torrent/CMakeLists.txt b/examples/network/torrent/CMakeLists.txt index 2a49e3800b..86bad72ab7 100644 --- a/examples/network/torrent/CMakeLists.txt +++ b/examples/network/torrent/CMakeLists.txt @@ -14,7 +14,7 @@ set(INSTALL_EXAMPLEDIR "examples") find_package(Qt5 COMPONENTS Network) find_package(Qt5 COMPONENTS Widgets) -add_executable(torrent WIN32 MACOSX_BUNDLE +add_qt_gui_executable(torrent WIN32 MACOSX_BUNDLE addtorrentdialog.cpp addtorrentdialog.h bencodeparser.cpp bencodeparser.h connectionmanager.cpp connectionmanager.h -- cgit v1.2.3