# #
# Copyright (C) 2023 SpyroSoft Solutions S.A. All rights reserved.
# #

#
# DO NOT EDIT THIS FILE!
# This file is generated by `scargo update`.
#
cmake_minimum_required(VERSION 3.22)

list(APPEND CMAKE_PREFIX_PATH "${CMAKE_BINARY_DIR}/generators/")
{% if config.project.target.family != 'esp32' %}
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
{% endif %}
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

{% if config.project.target.family == 'stm32' %}
{% include 'stm32.cmake.j2' %}
{% elif config.project.target.family == 'x86' %}
{% include 'x86.cmake.j2' %}
{% elif config.project.target.family == "esp32" %}
{% include 'esp32.cmake.j2' %}
{% endif %}

{% for key, value in config.project.cmake_variables.items() %}
set({{ key }} "{{ value }}")
{% endfor %}
{% for profile_name, profile in config.profiles.items() %}
    {% if profile.extras %}
# {{ profile_name }}
IF("${CMAKE_BUILD_TYPE}" STREQUAL "{{ profile_name }}")
        {% for key, value in profile.extras.items() %}
    SET({{ key }} {{ value }})
        {% endfor %}
ENDIF()
    {% endif %}
{% endfor %}

{% if config.project.target.family != "esp32" %}
add_subdirectory({{ config.source_dir_path.relative_to(config.project_root) }})
{% endif %}
