# #
# Copyright (C) 2022 SpyroSoft Solutions. All rights reserved.
# #

cmake_minimum_required(VERSION 3.22)

{% if config.tests %}
{% if config.tests.cc %}
set(CMAKE_C_COMPILER   "{{ config.tests.cc }}")
{% endif %} {# config.tests.cc #}

{% if config.tests.cxx %}
set(CMAKE_CXX_COMPILER "{{ config.tests.cxx }}")
{% endif %} {# config.tests.cxx #}

set(CMAKE_CXX_STANDARD {{ cxxstandard }})

{% if config.tests.cflags %}
set(CMAKE_C_FLAGS   "{{ config.tests.cflags }}")
{% endif %} {# config.tests.cflags #}

{% if config.tests.cxxflags %}
set(CMAKE_CXX_FLAGS "{{ config.tests.cxxflags }}")
{% endif %} {# config.tests.cxxflags #}

{% if config.tests.extras %}
{% for key, value in config.tests.extras.items() %}
SET({{ key }} {{ value }})
{% endfor %}
{% endif %} {# config.tests.extras #}
{% endif %} {# config.tests #}

project(tests LANGUAGES C CXX ASM)

find_package(GTest REQUIRED)
link_libraries(GTest::GTest GTest::Main)

enable_testing()

set(PROJECT_ROOT_DIR "${PROJECT_SOURCE_DIR}/..")
set(SOURCES_DIR "${PROJECT_ROOT_DIR}/{{ config.source_dir_path.name }}/")

add_subdirectory(mocks)
add_subdirectory(ut)
add_subdirectory(it)
