# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause

set(IS_NOT_YOCTO TRUE)
if (DEFINED ENV{BBPATH})
    set (IS_NOT_YOCTO FALSE)
endif()

set(QT_EXAMPLES_WITH_FETCHCONTENT ${IS_NOT_YOCTO} CACHE BOOL
    "Allow examples to use CMake FetchContent module")


if(TARGET Qt6::Quick)
    qt_internal_add_example(samegame)
    qt_internal_add_example(clocks)
    qt_internal_add_example(maroon)
endif()
if(TARGET Qt6::Quick AND TARGET Qt6::Graphs)
    qt_internal_add_example(stocqt)
endif()
if(TARGET Qt6::Quick AND TARGET Qt6::QuickControls2)
    qt_internal_add_example(colorpaletteclient)
    qt_internal_add_example(coffee)
    qt_internal_add_example(todolist)
    qt_internal_add_example(calqlatr)

    if(ANDROID OR IOS)
        qt_internal_add_example(hangman)
    endif()
endif()
if(TARGET Qt6::Quick AND TARGET Qt6::Network AND TARGET Qt6::QmlXmlListModel)
    qt_internal_add_example(rssnews)
endif()
if(TARGET Qt6::Quick AND TARGET Qt6::qsb AND TARGET Qt6::Pdf)
    qt_internal_add_example(photosurface)
endif()
if(TARGET Qt6::Widgets AND NOT ANDROID)
    qt_internal_add_example(documentviewer)
endif()
if(TARGET Qt::Quick AND TARGET Qt::Quick3D AND TARGET Qt6::Positioning)
    qt_internal_add_example(osmbuildings)
endif()
if(TARGET Qt::Quick AND TARGET Qt::QuickControls2 AND TARGET Qt::Quick3D)
    qt_internal_add_example(robotarm)
    qt_internal_add_example(FX_Material_Showroom)
    if(NOT WASM AND TARGET Qt::ExamplesAssetDownloaderPrivate AND QT_EXAMPLES_WITH_FETCHCONTENT
            AND CMAKE_VERSION VERSION_GREATER_EQUAL "3.19")
        qt_internal_add_example(car-configurator)
    endif()
endif()
if(TARGET Qt::Quick AND TARGET Qt::QuickControls2 AND TARGET Qt::Quick3D AND TARGET Qt::Quick3DPhysics AND TARGET Qt::Multimedia AND TARGET Qt::Sensors)
    qt_internal_add_example(dice)
endif()
if(TARGET Qt::Quick AND TARGET Qt::QuickControls2 AND TARGET Qt::Multimedia)
    qt_internal_add_example(mediaplayer)
endif()
if(TARGET Qt6::Quick AND TARGET Qt6::QuickControls2 AND TARGET Qt6::Charts AND TARGET Qt6::Svg)
    qt_internal_add_example(thermostat)
endif()
if(QT_FEATURE_ssl AND TARGET Qt6::WebSockets AND TARGET Qt6::Positioning AND TARGET Qt6::Location AND QT_FEATURE_zstd)
    qt_internal_add_example(lightningviewer)
else()
    message(WARNING "To build the Lightning Viewer Example, ensure the required features and modules are enabled: "
                    "SSL, WebSocket, Positioning, Location, zstd")
endif()
if(TARGET Qt::Quick AND TARGET Qt::Quick3D AND TARGET Qt::Quick3DXr AND TARGET Qt::Quick3DPhysics AND TARGET Qt::Multimedia)
    qt_internal_add_example(xr_physicsbase_teleportation)
endif()
