diff options
4 files changed, 13 insertions, 14 deletions
diff --git a/doc/src/cmake/cmake-manual.qdoc b/doc/src/cmake/cmake-manual.qdoc index 4e7f3bf9..be3d0520 100644 --- a/doc/src/cmake/cmake-manual.qdoc +++ b/doc/src/cmake/cmake-manual.qdoc @@ -165,21 +165,20 @@ \printuntil ) - \c{add_executable()} tells CMake that we want to build an executable (so not - a library) called \c{helloworld} as a target. The target should be built - from the C++ source file \c{main.cpp}. + \l{qt6_add_executable}{qt_add_executable()} tells CMake that we want to + build an executable (so not a library) called \c{helloworld} as a target. + It is a wrapper around the built-in \c add_executable() command, and + provides additional logic to automatically handle things like linking of + Qt plugins in static Qt builds, platform-specific customization of library + names, and so on. - Note that you typically do not list header files here. This is different + The target should be built from the C++ source file \c{main.cpp}. + + Typically, you do not list header files here. This is different from \l{qmake}, where header files need to be explicitly listed so that they are processed by the \l{Using the Meta-Object Compiler (moc)} {Meta-Object Compiler (moc)}. - For less trivial projects, you may want to call - \l{qt6_add_executable}{qt_add_executable()} instead. It is a wrapper around - the built-in \c add_executable() command, providing additional logic to - automatically handle things like linking of Qt plugins in static Qt builds, - platform-specific customization of library names and so on. - For creating libraries, see \l{qt6_add_library}{qt_add_library}. \printuntil @@ -296,7 +295,7 @@ executable target: \code - add_executable(helloworld + qt_add_executable(helloworld mainwindow.ui mainwindow.cpp main.cpp diff --git a/doc/src/cmake/snippets/cmake/helloworld_qtcore.cmake b/doc/src/cmake/snippets/cmake/helloworld_qtcore.cmake index ad16f33d..20412929 100644 --- a/doc/src/cmake/snippets/cmake/helloworld_qtcore.cmake +++ b/doc/src/cmake/snippets/cmake/helloworld_qtcore.cmake @@ -11,7 +11,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) find_package(Qt6 REQUIRED COMPONENTS Core) qt_standard_project_setup() -add_executable(helloworld +qt_add_executable(helloworld main.cpp ) diff --git a/doc/src/cmake/snippets/cmake/helloworld_qtwidgets.cmake b/doc/src/cmake/snippets/cmake/helloworld_qtwidgets.cmake index fec5f682..562ff3b2 100644 --- a/doc/src/cmake/snippets/cmake/helloworld_qtwidgets.cmake +++ b/doc/src/cmake/snippets/cmake/helloworld_qtwidgets.cmake @@ -11,7 +11,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) find_package(Qt6 REQUIRED COMPONENTS Widgets) qt_standard_project_setup() -add_executable(helloworld +qt_add_executable(helloworld mainwindow.ui mainwindow.cpp main.cpp diff --git a/doc/src/cmake/snippets/cmake/helloworld_src_businesslogic.cmake b/doc/src/cmake/snippets/cmake/helloworld_src_businesslogic.cmake index cd7384ac..f88ab7e5 100644 --- a/doc/src/cmake/snippets/cmake/helloworld_src_businesslogic.cmake +++ b/doc/src/cmake/snippets/cmake/helloworld_src_businesslogic.cmake @@ -1,7 +1,7 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: BSD-3-Clause -add_library(businesslogic STATIC +qt_add_library(businesslogic STATIC businesslogic.cpp ) target_link_libraries(businesslogic PRIVATE Qt6::Core) |