// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only

// **********************************************************************
// NOTE: the sections are not ordered by their logical order to avoid
// reshuffling the file each time the index order changes (i.e., often).
// Run the fixnavi.pl script to adjust the links to the index order.
// **********************************************************************

/*!
    \page creator-build-settings.html
    \previouspage creator-how-tos.html

    \ingroup creator-how-to-projects-configure
    \ingroup creator-how-to-build

    \title Configure projects for building

    To specify build settings for the selected \l{Managing kits}{kit}, go to
    \uicontrol Projects > \uicontrol {Build Settings}.

    \image {qtcreator-settings-build.webp} {Build Settings in the Projects mode}

    \section1 Manage build configurations

    To add a new build configuration to the list in
    \uicontrol {Edit build configuration}, select \uicontrol Add and then select the
    type of configuration to add. The options you have depend on the
    build system that you selected for the project. You can add as many build
    configurations as you need. You can also select \uicontrol Clone to
    add a build configuration that is based on the currently selected one.

    Select \uicontrol Rename to give the currently selected build configuration
    a new name.

    To delete the currently selected build configuration, select \uicontrol Remove.

    \section1 Edit build configurations

    Select the build configuration to edit in the
    \uicontrol {Edit build configuration} field.

    To edit the active build configuration, select \key {Ctrl+E, Ctrl+B}
    (or \key {Cmd+E, Cmd+B} on \macos).

    The available build settings depend on the build system that you selected
    for the project:

    \list
        \li \l{Building projects with CMake}{CMake}
        \li \l{Building projects with qmake}{qmake}
        \li \l{Qbs build configuration}{Qbs}
        \li \l{Meson build configuration}{Meson}
        \li \l{IncrediBuild Build Configuration}{IncrediBuild}
    \endlist

    This topic describes the build settings at a general level.

    \section1 Build on remote devices

    You can build applications on \l{Developing for remote Linux devices}
    {remote Linux} or \l{Add Docker devices}{Docker} devices if you
    have kits that specify the devices and toolchains to use. When the
    build device of the kit is a remote device, such as a remote Linux or
    Docker device, the \uicontrol Browse button next to the
    \uicontrol {Build directory} field shows options for selecting remote
    directories.

    Also, the \uicontrol {Open Terminal} button in the
    \uicontrol {Build Environment} section opens a terminal on the device.

    \section1 Start external processes

    \QC executes external processes to accomplish tasks such as building
    and running applications. To execute the processes, \QC uses shell
    commands that are native to the system. It constructs the commands from
    an executable name and optional command-line arguments.

    The executable name is specified in the executable fields: \uicontrol qmake,
    \uicontrol Make, \uicontrol Command, or \uicontrol Executable. It is either
    derived from the project or specified manually. When you specify executables
    manually, you can reference environment variables and \QC variables.
    However, no quoting rules apply.

    You can specify command-line arguments in the arguments fields:
    \uicontrol Arguments, \uicontrol {Additional arguments},
    \uicontrol {CMake arguments}, \uicontrol {Command arguments},
    \uicontrol {Default arguments}, \uicontrol {Extra arguments},
    \uicontrol {Make arguments}, or \uicontrol {Tool arguments}.
    You can create shell command lines
    that can have redirection and other advanced constructs. However, some
    more complex use cases, such as piping test data into the application being
    tested or grouping commands, are not supported because the value of the
    \uicontrol Executable field is always placed first when constructing the command.

    You can \l {Use \QC variables}{use \QC variables} in arguments,
    executable paths, and working directories. That is, in all fields where you
    see the \inlineimage {icons/replace.png} {Variables} (\uicontrol {Variables})
    button.

    \section1 Add build steps

    \image {qtcreator-cmake-build-steps.webp} {CMake build steps}

    In \uicontrol{Build Steps}, you can change the settings for the build system
    selected for building the project:

    \list
        \li \l{CMake Build Steps}{CMake}
        \li \l{qmake Build Steps}{qmake}
        \li \l{Qbs Build Steps}{Qbs}
        \li \l{Meson Build Steps}{Meson}
        \li \l{Conan Build Configuration}{Conan}
    \endlist

    You can also edit the build steps for the
    \l{Partially supported project types}{partially supported build systems}.

    You can use \l{IncrediBuild Build Steps}{IncrediBuild} to accelerate the
    build process when using qmake or CMake.

    To manage build steps:

        \list
        \li To add a build step, select \uicontrol {Add Build Step} and select
            the step to add.
        \li To disable a step you added, select
            \inlineimage {icons/buildstepdisable.png} {Disable}
            (\uicontrol {Disable}).
        \li To change the order of steps, select
            \inlineimage {icons/arrowup.png} {Move Up} (\uicontrol {Move Up})
            and \inlineimage {icons/arrowdown.png} {Move Down}
            (\uicontrol {Move Down}).
        \li To remove a step, select \inlineimage {icons/close.png} {Remove Item}
            (\uicontrol {Remove Item}).
    \endlist

    \section2 Add custom build steps

    To add custom steps to the build settings, select
    \uicontrol {Add Build Step} > \uicontrol {Custom Process Step}.


    \image {qtcreator-build-steps-custom.png} {Custom Process Step}

    \section2 Execute custom commands

    To execute custom commands when building for embedded devices, select
    \uicontrol {Add Build Step} > \uicontrol {Custom Remote Command
    (via adb shell)} (commercial only) and enter the command to execute.

    \section1 Add clean steps

    You can use the cleaning process to remove intermediate files. This process
    might help you to fix obscure issues during the process of building a
    project using:

    \list
        \li \l{CMake Clean Steps}{CMake}
        \li qmake
        \li \l{Qbs Clean Steps}{Qbs}
        \li \l{Meson Clean Steps}{Meson}
        \li \l{IncrediBuild Clean Steps}{IncrediBuild}
    \endlist

    You can define the clean steps for your builds in \uicontrol {Clean Steps}.
    To add a clean step using make or a custom process, select
    \uicontrol{Add Clean Step} and select the step to add.

    \image {qtcreator-cmake-clean-steps.webp} {Clean steps}

    \sa {Building and running projects}, {Select the build system}, {Use \QC variables},
    {Enable debugging}, {Setting up QML debugging},
    {Build Systems}{Reference: Build Systems}
*/
