Doc: Use qt_add_executable() not add_executable() in snippets

Changes code snippets that are visible in the docs.

Task-number: QTBUG-113116
Change-Id: If743234bfe6947acf02307bf1144daad4fba5d73
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 3abfd4aa7c709202dbbd0d24f3a0cf4f6108fea5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Leena Miettinen 2023-04-25 09:13:18 +02:00 committed by Qt Cherry-pick Bot
parent c9f3241426
commit e5fb960796
3 changed files with 7 additions and 7 deletions

View File

@ -4,17 +4,17 @@
#! [qt_wrap_cpp] #! [qt_wrap_cpp]
set(SOURCES myapp.cpp main.cpp) set(SOURCES myapp.cpp main.cpp)
qt_wrap_cpp(SOURCES myapp.h) qt_wrap_cpp(SOURCES myapp.h)
add_executable(myapp ${SOURCES}) qt_add_executable(myapp ${SOURCES})
#! [qt_wrap_cpp] #! [qt_wrap_cpp]
#! [qt_add_resources] #! [qt_add_resources]
set(SOURCES main.cpp) set(SOURCES main.cpp)
qt_add_resources(SOURCES example.qrc) qt_add_resources(SOURCES example.qrc)
add_executable(myapp ${SOURCES}) qt_add_executable(myapp ${SOURCES})
#! [qt_add_resources] #! [qt_add_resources]
#! [qt_add_resources_target] #! [qt_add_resources_target]
add_executable(myapp main.cpp) qt_add_executable(myapp main.cpp)
qt_add_resources(myapp "images" qt_add_resources(myapp "images"
PREFIX "/images" PREFIX "/images"
FILES image1.png image2.png) FILES image1.png image2.png)
@ -28,7 +28,7 @@ qt_add_big_resources(SOURCES big_resource.qrc)
list(APPEND SOURCES big_resource.qrc) list(APPEND SOURCES big_resource.qrc)
set_property(SOURCE big_resource.qrc PROPERTY SKIP_AUTORCC ON) set_property(SOURCE big_resource.qrc PROPERTY SKIP_AUTORCC ON)
add_executable(myapp ${SOURCES}) qt_add_executable(myapp ${SOURCES})
#! [qt_add_big_resources] #! [qt_add_big_resources]
#! [qt_add_binary_resources] #! [qt_add_binary_resources]
@ -41,7 +41,7 @@ qt_generate_moc(main.cpp main.moc TARGET myapp)
#! [qt_generate_moc] #! [qt_generate_moc]
#! [qt_import_plugins] #! [qt_import_plugins]
add_executable(myapp main.cpp) qt_add_executable(myapp main.cpp)
target_link_libraries(myapp Qt::Gui Qt::Sql) target_link_libraries(myapp Qt::Gui Qt::Sql)
qt_import_plugins(myapp qt_import_plugins(myapp
INCLUDE Qt::QCocoaIntegrationPlugin INCLUDE Qt::QCocoaIntegrationPlugin

View File

@ -8,7 +8,7 @@ set(CMAKE_AUTOMOC ON)
enable_testing(true) enable_testing(true)
add_executable(mytest tst_mytest.cpp) qt_add_executable(mytest tst_mytest.cpp)
add_test(NAME mytest COMMAND mytest) add_test(NAME mytest COMMAND mytest)
target_link_libraries(mytest PRIVATE Qt::Test) target_link_libraries(mytest PRIVATE Qt::Test)

View File

@ -4,5 +4,5 @@
#! [qt_wrap_ui] #! [qt_wrap_ui]
set(SOURCES mainwindow.cpp main.cpp) set(SOURCES mainwindow.cpp main.cpp)
qt_wrap_ui(SOURCES mainwindow.ui) qt_wrap_ui(SOURCES mainwindow.ui)
add_executable(myapp ${SOURCES}) qt_add_executable(myapp ${SOURCES})
#! [qt_wrap_ui] #! [qt_wrap_ui]