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/graphicsview/anchorlayout/CMakeLists.txt | 2 +- examples/widgets/graphicsview/basicgraphicslayouts/CMakeLists.txt | 2 +- examples/widgets/graphicsview/boxes/CMakeLists.txt | 2 +- examples/widgets/graphicsview/chip/CMakeLists.txt | 2 +- examples/widgets/graphicsview/collidingmice/CMakeLists.txt | 2 +- examples/widgets/graphicsview/diagramscene/CMakeLists.txt | 2 +- examples/widgets/graphicsview/dragdroprobot/CMakeLists.txt | 2 +- examples/widgets/graphicsview/elasticnodes/CMakeLists.txt | 2 +- examples/widgets/graphicsview/embeddeddialogs/CMakeLists.txt | 2 +- examples/widgets/graphicsview/flowlayout/CMakeLists.txt | 2 +- examples/widgets/graphicsview/simpleanchorlayout/CMakeLists.txt | 2 +- examples/widgets/graphicsview/weatheranchorlayout/CMakeLists.txt | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) (limited to 'examples/widgets/graphicsview') diff --git a/examples/widgets/graphicsview/anchorlayout/CMakeLists.txt b/examples/widgets/graphicsview/anchorlayout/CMakeLists.txt index 1488f394c6..9676dbbcba 100644 --- a/examples/widgets/graphicsview/anchorlayout/CMakeLists.txt +++ b/examples/widgets/graphicsview/anchorlayout/CMakeLists.txt @@ -13,7 +13,7 @@ set(INSTALL_EXAMPLEDIR "examples") find_package(Qt5 COMPONENTS Widgets) -add_executable(anchorlayout WIN32 MACOSX_BUNDLE +add_qt_gui_executable(anchorlayout WIN32 MACOSX_BUNDLE main.cpp ) target_link_libraries(anchorlayout PUBLIC diff --git a/examples/widgets/graphicsview/basicgraphicslayouts/CMakeLists.txt b/examples/widgets/graphicsview/basicgraphicslayouts/CMakeLists.txt index 0ce632e6b6..982fd541c6 100644 --- a/examples/widgets/graphicsview/basicgraphicslayouts/CMakeLists.txt +++ b/examples/widgets/graphicsview/basicgraphicslayouts/CMakeLists.txt @@ -13,7 +13,7 @@ set(INSTALL_EXAMPLEDIR "examples") find_package(Qt5 COMPONENTS Widgets) -add_executable(basicgraphicslayouts WIN32 MACOSX_BUNDLE +add_qt_gui_executable(basicgraphicslayouts WIN32 MACOSX_BUNDLE basicgraphicslayouts.qrc layoutitem.cpp layoutitem.h main.cpp diff --git a/examples/widgets/graphicsview/boxes/CMakeLists.txt b/examples/widgets/graphicsview/boxes/CMakeLists.txt index 4e1d105a3a..b5441bcfdf 100644 --- a/examples/widgets/graphicsview/boxes/CMakeLists.txt +++ b/examples/widgets/graphicsview/boxes/CMakeLists.txt @@ -15,7 +15,7 @@ find_package(Qt5 COMPONENTS OpenGL) find_package(Qt5 COMPONENTS Widgets) -add_executable(boxes WIN32 MACOSX_BUNDLE +add_qt_gui_executable(boxes WIN32 MACOSX_BUNDLE 3rdparty/fbm.c 3rdparty/fbm.h boxes.qrc glbuffers.cpp glbuffers.h diff --git a/examples/widgets/graphicsview/chip/CMakeLists.txt b/examples/widgets/graphicsview/chip/CMakeLists.txt index 81f290be99..141645a22c 100644 --- a/examples/widgets/graphicsview/chip/CMakeLists.txt +++ b/examples/widgets/graphicsview/chip/CMakeLists.txt @@ -15,7 +15,7 @@ find_package(Qt5 COMPONENTS Widgets) find_package(Qt5 COMPONENTS OpenGL) # special case find_package(Qt5 COMPONENTS PrintSupport) # special case -add_executable(chip WIN32 MACOSX_BUNDLE +add_qt_gui_executable(chip WIN32 MACOSX_BUNDLE chip.cpp chip.h images.qrc main.cpp diff --git a/examples/widgets/graphicsview/collidingmice/CMakeLists.txt b/examples/widgets/graphicsview/collidingmice/CMakeLists.txt index 36b1fb85c1..9001858817 100644 --- a/examples/widgets/graphicsview/collidingmice/CMakeLists.txt +++ b/examples/widgets/graphicsview/collidingmice/CMakeLists.txt @@ -13,7 +13,7 @@ set(INSTALL_EXAMPLEDIR "examples") find_package(Qt5 COMPONENTS Widgets) -add_executable(collidingmice WIN32 MACOSX_BUNDLE +add_qt_gui_executable(collidingmice WIN32 MACOSX_BUNDLE main.cpp mice.qrc mouse.cpp mouse.h diff --git a/examples/widgets/graphicsview/diagramscene/CMakeLists.txt b/examples/widgets/graphicsview/diagramscene/CMakeLists.txt index 76f60aabaa..bfdd3b8f5b 100644 --- a/examples/widgets/graphicsview/diagramscene/CMakeLists.txt +++ b/examples/widgets/graphicsview/diagramscene/CMakeLists.txt @@ -13,7 +13,7 @@ set(INSTALL_EXAMPLEDIR "examples") find_package(Qt5 COMPONENTS Widgets) -add_executable(diagramscene WIN32 MACOSX_BUNDLE +add_qt_gui_executable(diagramscene WIN32 MACOSX_BUNDLE arrow.cpp arrow.h diagramitem.cpp diagramitem.h diagramscene.cpp diagramscene.h diagramscene.qrc diff --git a/examples/widgets/graphicsview/dragdroprobot/CMakeLists.txt b/examples/widgets/graphicsview/dragdroprobot/CMakeLists.txt index 2adcff3ae5..d85dcd1ff9 100644 --- a/examples/widgets/graphicsview/dragdroprobot/CMakeLists.txt +++ b/examples/widgets/graphicsview/dragdroprobot/CMakeLists.txt @@ -13,7 +13,7 @@ set(INSTALL_EXAMPLEDIR "examples") find_package(Qt5 COMPONENTS Widgets) -add_executable(dragdroprobot WIN32 MACOSX_BUNDLE +add_qt_gui_executable(dragdroprobot WIN32 MACOSX_BUNDLE coloritem.cpp coloritem.h main.cpp robot.cpp robot.h robot.qrc diff --git a/examples/widgets/graphicsview/elasticnodes/CMakeLists.txt b/examples/widgets/graphicsview/elasticnodes/CMakeLists.txt index 42fd71fa5f..b1e04b2a20 100644 --- a/examples/widgets/graphicsview/elasticnodes/CMakeLists.txt +++ b/examples/widgets/graphicsview/elasticnodes/CMakeLists.txt @@ -13,7 +13,7 @@ set(INSTALL_EXAMPLEDIR "examples") find_package(Qt5 COMPONENTS Widgets) -add_executable(elasticnodes WIN32 MACOSX_BUNDLE +add_qt_gui_executable(elasticnodes WIN32 MACOSX_BUNDLE edge.cpp edge.h graphwidget.cpp graphwidget.h main.cpp diff --git a/examples/widgets/graphicsview/embeddeddialogs/CMakeLists.txt b/examples/widgets/graphicsview/embeddeddialogs/CMakeLists.txt index 2652b985df..fc9f6086ce 100644 --- a/examples/widgets/graphicsview/embeddeddialogs/CMakeLists.txt +++ b/examples/widgets/graphicsview/embeddeddialogs/CMakeLists.txt @@ -13,7 +13,7 @@ set(INSTALL_EXAMPLEDIR "examples") find_package(Qt5 COMPONENTS Widgets) -add_executable(embeddeddialogs WIN32 MACOSX_BUNDLE +add_qt_gui_executable(embeddeddialogs WIN32 MACOSX_BUNDLE customproxy.cpp customproxy.h embeddeddialog.cpp embeddeddialog.h embeddeddialog.ui embeddeddialogs.qrc diff --git a/examples/widgets/graphicsview/flowlayout/CMakeLists.txt b/examples/widgets/graphicsview/flowlayout/CMakeLists.txt index 96b82b7955..ef5a4d5564 100644 --- a/examples/widgets/graphicsview/flowlayout/CMakeLists.txt +++ b/examples/widgets/graphicsview/flowlayout/CMakeLists.txt @@ -13,7 +13,7 @@ set(INSTALL_EXAMPLEDIR "examples") find_package(Qt5 COMPONENTS Widgets) -add_executable(graphicsview_flowlayout WIN32 MACOSX_BUNDLE # special case: renamed flowlayout +add_qt_gui_executable(graphicsview_flowlayout WIN32 MACOSX_BUNDLE # special case: renamed flowlayout flowlayout.cpp flowlayout.h main.cpp window.cpp window.h diff --git a/examples/widgets/graphicsview/simpleanchorlayout/CMakeLists.txt b/examples/widgets/graphicsview/simpleanchorlayout/CMakeLists.txt index afb35675d8..bc1564cb8c 100644 --- a/examples/widgets/graphicsview/simpleanchorlayout/CMakeLists.txt +++ b/examples/widgets/graphicsview/simpleanchorlayout/CMakeLists.txt @@ -13,7 +13,7 @@ set(INSTALL_EXAMPLEDIR "examples") find_package(Qt5 COMPONENTS Widgets) -add_executable(simpleanchorlayout WIN32 MACOSX_BUNDLE +add_qt_gui_executable(simpleanchorlayout WIN32 MACOSX_BUNDLE main.cpp ) target_link_libraries(simpleanchorlayout PUBLIC diff --git a/examples/widgets/graphicsview/weatheranchorlayout/CMakeLists.txt b/examples/widgets/graphicsview/weatheranchorlayout/CMakeLists.txt index 750352e325..22e92cc68b 100644 --- a/examples/widgets/graphicsview/weatheranchorlayout/CMakeLists.txt +++ b/examples/widgets/graphicsview/weatheranchorlayout/CMakeLists.txt @@ -13,7 +13,7 @@ set(INSTALL_EXAMPLEDIR "examples") find_package(Qt5 COMPONENTS Widgets) -add_executable(weatheranchorlayout WIN32 MACOSX_BUNDLE +add_qt_gui_executable(weatheranchorlayout WIN32 MACOSX_BUNDLE main.cpp weatheranchorlayout.qrc ) -- cgit v1.2.3