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/corelib/ipc/localfortuneclient/CMakeLists.txt | 2 +- examples/corelib/ipc/localfortuneserver/CMakeLists.txt | 2 +- examples/corelib/ipc/sharedmemory/CMakeLists.txt | 2 +- examples/corelib/mimetypes/mimetypebrowser/CMakeLists.txt | 2 +- examples/corelib/threads/mandelbrot/CMakeLists.txt | 2 +- examples/corelib/threads/queuedcustomtype/CMakeLists.txt | 2 +- examples/corelib/tools/contiguouscache/CMakeLists.txt | 2 +- examples/corelib/tools/customtype/CMakeLists.txt | 2 +- examples/corelib/tools/customtypesending/CMakeLists.txt | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) (limited to 'examples/corelib') diff --git a/examples/corelib/ipc/localfortuneclient/CMakeLists.txt b/examples/corelib/ipc/localfortuneclient/CMakeLists.txt index ae0492fe26..a171965bbb 100644 --- a/examples/corelib/ipc/localfortuneclient/CMakeLists.txt +++ b/examples/corelib/ipc/localfortuneclient/CMakeLists.txt @@ -14,7 +14,7 @@ set(INSTALL_EXAMPLEDIR "examples") find_package(Qt5 COMPONENTS Network) find_package(Qt5 COMPONENTS Widgets) -add_executable(localfortuneclient WIN32 MACOSX_BUNDLE +add_qt_gui_executable(localfortuneclient WIN32 MACOSX_BUNDLE client.cpp client.h main.cpp ) diff --git a/examples/corelib/ipc/localfortuneserver/CMakeLists.txt b/examples/corelib/ipc/localfortuneserver/CMakeLists.txt index 11fcf4e297..5804aa69fa 100644 --- a/examples/corelib/ipc/localfortuneserver/CMakeLists.txt +++ b/examples/corelib/ipc/localfortuneserver/CMakeLists.txt @@ -14,7 +14,7 @@ set(INSTALL_EXAMPLEDIR "examples") find_package(Qt5 COMPONENTS Network) find_package(Qt5 COMPONENTS Widgets) -add_executable(localfortuneserver WIN32 MACOSX_BUNDLE +add_qt_gui_executable(localfortuneserver WIN32 MACOSX_BUNDLE main.cpp server.cpp server.h ) diff --git a/examples/corelib/ipc/sharedmemory/CMakeLists.txt b/examples/corelib/ipc/sharedmemory/CMakeLists.txt index f4e3780348..55f42ada88 100644 --- a/examples/corelib/ipc/sharedmemory/CMakeLists.txt +++ b/examples/corelib/ipc/sharedmemory/CMakeLists.txt @@ -13,7 +13,7 @@ set(INSTALL_EXAMPLEDIR "examples") find_package(Qt5 COMPONENTS Widgets) -add_executable(sharedmemory WIN32 MACOSX_BUNDLE +add_qt_gui_executable(sharedmemory WIN32 MACOSX_BUNDLE dialog.cpp dialog.h dialog.ui main.cpp ) diff --git a/examples/corelib/mimetypes/mimetypebrowser/CMakeLists.txt b/examples/corelib/mimetypes/mimetypebrowser/CMakeLists.txt index 05e68e6d67..1493bdd31d 100644 --- a/examples/corelib/mimetypes/mimetypebrowser/CMakeLists.txt +++ b/examples/corelib/mimetypes/mimetypebrowser/CMakeLists.txt @@ -13,7 +13,7 @@ set(INSTALL_EXAMPLEDIR "examples") find_package(Qt5 COMPONENTS Widgets) -add_executable(mimetypebrowser WIN32 MACOSX_BUNDLE +add_qt_gui_executable(mimetypebrowser WIN32 MACOSX_BUNDLE main.cpp mainwindow.cpp mainwindow.h mimetypemodel.cpp mimetypemodel.h diff --git a/examples/corelib/threads/mandelbrot/CMakeLists.txt b/examples/corelib/threads/mandelbrot/CMakeLists.txt index 9b5995b1a5..cc0385a9ce 100644 --- a/examples/corelib/threads/mandelbrot/CMakeLists.txt +++ b/examples/corelib/threads/mandelbrot/CMakeLists.txt @@ -13,7 +13,7 @@ set(INSTALL_EXAMPLEDIR "examples") find_package(Qt5 COMPONENTS Widgets) -add_executable(mandelbrot WIN32 MACOSX_BUNDLE +add_qt_gui_executable(mandelbrot WIN32 MACOSX_BUNDLE main.cpp mandelbrotwidget.cpp mandelbrotwidget.h renderthread.cpp renderthread.h diff --git a/examples/corelib/threads/queuedcustomtype/CMakeLists.txt b/examples/corelib/threads/queuedcustomtype/CMakeLists.txt index 9fc8234e4d..ef07b36301 100644 --- a/examples/corelib/threads/queuedcustomtype/CMakeLists.txt +++ b/examples/corelib/threads/queuedcustomtype/CMakeLists.txt @@ -13,7 +13,7 @@ set(INSTALL_EXAMPLEDIR "examples") find_package(Qt5 COMPONENTS Widgets) -add_executable(queuedcustomtype WIN32 MACOSX_BUNDLE +add_qt_gui_executable(queuedcustomtype WIN32 MACOSX_BUNDLE block.cpp block.h main.cpp renderthread.cpp renderthread.h diff --git a/examples/corelib/tools/contiguouscache/CMakeLists.txt b/examples/corelib/tools/contiguouscache/CMakeLists.txt index 62214a46d5..9b0638bea2 100644 --- a/examples/corelib/tools/contiguouscache/CMakeLists.txt +++ b/examples/corelib/tools/contiguouscache/CMakeLists.txt @@ -13,7 +13,7 @@ set(INSTALL_EXAMPLEDIR "examples") find_package(Qt5 COMPONENTS Widgets) -add_executable(contiguouscache WIN32 MACOSX_BUNDLE +add_qt_gui_executable(contiguouscache WIN32 MACOSX_BUNDLE main.cpp randomlistmodel.cpp randomlistmodel.h ) diff --git a/examples/corelib/tools/customtype/CMakeLists.txt b/examples/corelib/tools/customtype/CMakeLists.txt index 394534f5ee..2cab51c073 100644 --- a/examples/corelib/tools/customtype/CMakeLists.txt +++ b/examples/corelib/tools/customtype/CMakeLists.txt @@ -13,7 +13,7 @@ set(INSTALL_EXAMPLEDIR "examples") find_package(Qt5 COMPONENTS Widgets) -add_executable(customtype WIN32 MACOSX_BUNDLE +add_qt_gui_executable(customtype WIN32 MACOSX_BUNDLE main.cpp message.cpp message.h ) diff --git a/examples/corelib/tools/customtypesending/CMakeLists.txt b/examples/corelib/tools/customtypesending/CMakeLists.txt index 53a39c57ce..06ed26ba48 100644 --- a/examples/corelib/tools/customtypesending/CMakeLists.txt +++ b/examples/corelib/tools/customtypesending/CMakeLists.txt @@ -13,7 +13,7 @@ set(INSTALL_EXAMPLEDIR "examples") find_package(Qt5 COMPONENTS Widgets) -add_executable(customtypesending WIN32 MACOSX_BUNDLE +add_qt_gui_executable(customtypesending WIN32 MACOSX_BUNDLE main.cpp message.cpp message.h window.cpp window.h -- cgit v1.2.3