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/widgets/tools/codecs/CMakeLists.txt | 2 +- examples/widgets/tools/completer/CMakeLists.txt | 2 +- examples/widgets/tools/customcompleter/CMakeLists.txt | 2 +- examples/widgets/tools/echoplugin/echowindow/CMakeLists.txt | 2 +- examples/widgets/tools/i18n/CMakeLists.txt | 2 +- examples/widgets/tools/plugandpaint/app/CMakeLists.txt | 2 +- examples/widgets/tools/regexp/CMakeLists.txt | 2 +- examples/widgets/tools/regularexpression/CMakeLists.txt | 2 +- examples/widgets/tools/settingseditor/CMakeLists.txt | 2 +- examples/widgets/tools/styleplugin/stylewindow/CMakeLists.txt | 2 +- examples/widgets/tools/treemodelcompleter/CMakeLists.txt | 2 +- examples/widgets/tools/undo/CMakeLists.txt | 2 +- examples/widgets/tools/undoframework/CMakeLists.txt | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) (limited to 'examples/widgets/tools') diff --git a/examples/widgets/tools/codecs/CMakeLists.txt b/examples/widgets/tools/codecs/CMakeLists.txt index 99040e807e..0bb5f37938 100644 --- a/examples/widgets/tools/codecs/CMakeLists.txt +++ b/examples/widgets/tools/codecs/CMakeLists.txt @@ -13,7 +13,7 @@ set(INSTALL_EXAMPLEDIR "examples") find_package(Qt5 COMPONENTS Widgets) -add_executable(codecs WIN32 MACOSX_BUNDLE +add_qt_gui_executable(codecs WIN32 MACOSX_BUNDLE codecs.qrc encodingdialog.cpp encodingdialog.h main.cpp diff --git a/examples/widgets/tools/completer/CMakeLists.txt b/examples/widgets/tools/completer/CMakeLists.txt index 9db2d089d9..8e86cc6b89 100644 --- a/examples/widgets/tools/completer/CMakeLists.txt +++ b/examples/widgets/tools/completer/CMakeLists.txt @@ -13,7 +13,7 @@ set(INSTALL_EXAMPLEDIR "examples") find_package(Qt5 COMPONENTS Widgets) -add_executable(completer WIN32 MACOSX_BUNDLE +add_qt_gui_executable(completer WIN32 MACOSX_BUNDLE completer.qrc fsmodel.cpp fsmodel.h main.cpp diff --git a/examples/widgets/tools/customcompleter/CMakeLists.txt b/examples/widgets/tools/customcompleter/CMakeLists.txt index 7c1db10bef..7ac00d7345 100644 --- a/examples/widgets/tools/customcompleter/CMakeLists.txt +++ b/examples/widgets/tools/customcompleter/CMakeLists.txt @@ -13,7 +13,7 @@ set(INSTALL_EXAMPLEDIR "examples") find_package(Qt5 COMPONENTS Widgets) -add_executable(customcompleter WIN32 MACOSX_BUNDLE +add_qt_gui_executable(customcompleter WIN32 MACOSX_BUNDLE customcompleter.qrc main.cpp mainwindow.cpp mainwindow.h diff --git a/examples/widgets/tools/echoplugin/echowindow/CMakeLists.txt b/examples/widgets/tools/echoplugin/echowindow/CMakeLists.txt index 941007505d..20615d1e3b 100644 --- a/examples/widgets/tools/echoplugin/echowindow/CMakeLists.txt +++ b/examples/widgets/tools/echoplugin/echowindow/CMakeLists.txt @@ -13,7 +13,7 @@ set(INSTALL_EXAMPLEDIR "examples") find_package(Qt5 COMPONENTS Widgets) -add_executable(echopluginwindow WIN32 MACOSX_BUNDLE # special case: renamed target +add_qt_gui_executable(echopluginwindow WIN32 MACOSX_BUNDLE # special case: renamed target echointerface.h echowindow.cpp echowindow.h main.cpp diff --git a/examples/widgets/tools/i18n/CMakeLists.txt b/examples/widgets/tools/i18n/CMakeLists.txt index 3835cc27ea..a0347d8453 100644 --- a/examples/widgets/tools/i18n/CMakeLists.txt +++ b/examples/widgets/tools/i18n/CMakeLists.txt @@ -13,7 +13,7 @@ set(INSTALL_EXAMPLEDIR "examples") find_package(Qt5 COMPONENTS Widgets) -add_executable(i18n WIN32 MACOSX_BUNDLE +add_qt_gui_executable(i18n WIN32 MACOSX_BUNDLE i18n.qrc languagechooser.cpp languagechooser.h main.cpp diff --git a/examples/widgets/tools/plugandpaint/app/CMakeLists.txt b/examples/widgets/tools/plugandpaint/app/CMakeLists.txt index 2e730791cc..a7c642a1be 100644 --- a/examples/widgets/tools/plugandpaint/app/CMakeLists.txt +++ b/examples/widgets/tools/plugandpaint/app/CMakeLists.txt @@ -13,7 +13,7 @@ set(INSTALL_EXAMPLEDIR "examples") find_package(Qt5 COMPONENTS Widgets) -add_executable(plugandpaint WIN32 MACOSX_BUNDLE +add_qt_gui_executable(plugandpaint WIN32 MACOSX_BUNDLE interfaces.h main.cpp mainwindow.cpp mainwindow.h diff --git a/examples/widgets/tools/regexp/CMakeLists.txt b/examples/widgets/tools/regexp/CMakeLists.txt index 026e72673a..0b64cf06f8 100644 --- a/examples/widgets/tools/regexp/CMakeLists.txt +++ b/examples/widgets/tools/regexp/CMakeLists.txt @@ -13,7 +13,7 @@ set(INSTALL_EXAMPLEDIR "examples") find_package(Qt5 COMPONENTS Widgets) -add_executable(regexp WIN32 MACOSX_BUNDLE +add_qt_gui_executable(regexp WIN32 MACOSX_BUNDLE main.cpp regexpdialog.cpp regexpdialog.h ) diff --git a/examples/widgets/tools/regularexpression/CMakeLists.txt b/examples/widgets/tools/regularexpression/CMakeLists.txt index ba7274b007..a9ce374ce2 100644 --- a/examples/widgets/tools/regularexpression/CMakeLists.txt +++ b/examples/widgets/tools/regularexpression/CMakeLists.txt @@ -13,7 +13,7 @@ set(INSTALL_EXAMPLEDIR "examples") find_package(Qt5 COMPONENTS Widgets) -add_executable(regularexpression WIN32 MACOSX_BUNDLE +add_qt_gui_executable(regularexpression WIN32 MACOSX_BUNDLE main.cpp regularexpression.qrc regularexpressiondialog.cpp regularexpressiondialog.h diff --git a/examples/widgets/tools/settingseditor/CMakeLists.txt b/examples/widgets/tools/settingseditor/CMakeLists.txt index 7bfa75cade..49a014e359 100644 --- a/examples/widgets/tools/settingseditor/CMakeLists.txt +++ b/examples/widgets/tools/settingseditor/CMakeLists.txt @@ -13,7 +13,7 @@ set(INSTALL_EXAMPLEDIR "examples") find_package(Qt5 COMPONENTS Widgets) -add_executable(settingseditor WIN32 MACOSX_BUNDLE +add_qt_gui_executable(settingseditor WIN32 MACOSX_BUNDLE locationdialog.cpp locationdialog.h main.cpp mainwindow.cpp mainwindow.h diff --git a/examples/widgets/tools/styleplugin/stylewindow/CMakeLists.txt b/examples/widgets/tools/styleplugin/stylewindow/CMakeLists.txt index 3e3893ad03..6e47082471 100644 --- a/examples/widgets/tools/styleplugin/stylewindow/CMakeLists.txt +++ b/examples/widgets/tools/styleplugin/stylewindow/CMakeLists.txt @@ -13,7 +13,7 @@ set(INSTALL_EXAMPLEDIR "examples") find_package(Qt5 COMPONENTS Widgets) -add_executable(styleplugin WIN32 MACOSX_BUNDLE +add_qt_gui_executable(styleplugin WIN32 MACOSX_BUNDLE main.cpp stylewindow.cpp stylewindow.h ) diff --git a/examples/widgets/tools/treemodelcompleter/CMakeLists.txt b/examples/widgets/tools/treemodelcompleter/CMakeLists.txt index a6bd7177f1..9fa16e06dd 100644 --- a/examples/widgets/tools/treemodelcompleter/CMakeLists.txt +++ b/examples/widgets/tools/treemodelcompleter/CMakeLists.txt @@ -13,7 +13,7 @@ set(INSTALL_EXAMPLEDIR "examples") find_package(Qt5 COMPONENTS Widgets) -add_executable(treemodelcompleter WIN32 MACOSX_BUNDLE +add_qt_gui_executable(treemodelcompleter WIN32 MACOSX_BUNDLE main.cpp mainwindow.cpp mainwindow.h treemodelcompleter.cpp treemodelcompleter.h treemodelcompleter.qrc diff --git a/examples/widgets/tools/undo/CMakeLists.txt b/examples/widgets/tools/undo/CMakeLists.txt index 5cd91dda0a..bc4a876211 100644 --- a/examples/widgets/tools/undo/CMakeLists.txt +++ b/examples/widgets/tools/undo/CMakeLists.txt @@ -13,7 +13,7 @@ set(INSTALL_EXAMPLEDIR "examples") find_package(Qt5 COMPONENTS Widgets) -add_executable(undo WIN32 MACOSX_BUNDLE +add_qt_gui_executable(undo WIN32 MACOSX_BUNDLE commands.cpp commands.h document.cpp document.h main.cpp diff --git a/examples/widgets/tools/undoframework/CMakeLists.txt b/examples/widgets/tools/undoframework/CMakeLists.txt index a1a6c2c624..064cb65150 100644 --- a/examples/widgets/tools/undoframework/CMakeLists.txt +++ b/examples/widgets/tools/undoframework/CMakeLists.txt @@ -13,7 +13,7 @@ set(INSTALL_EXAMPLEDIR "examples") find_package(Qt5 COMPONENTS Widgets) -add_executable(undoframework WIN32 MACOSX_BUNDLE +add_qt_gui_executable(undoframework WIN32 MACOSX_BUNDLE commands.cpp commands.h diagramitem.cpp diagramitem.h diagramscene.cpp diagramscene.h -- cgit v1.2.3