cmake_minimum_required(VERSION 3.16)
project(EmbeddedStateExamples LANGUAGES CXX)

enable_testing()
foreach(example IN ITEMS Blue Button Phase Mode)
    add_executable(${example} ${example}.cpp)
    set_target_properties(${example} PROPERTIES
        CXX_STANDARD 17
        CXX_STANDARD_REQUIRED YES
        CXX_EXTENSIONS NO)
    if(MSVC)
        target_compile_options(${example} PRIVATE /W4 /WX /utf-8)
    else()
        target_compile_options(${example} PRIVATE
            -Wall -Wextra -Wpedantic -Wconversion -Wsign-conversion
            -Werror -fno-exceptions -fno-rtti)
    endif()
    add_test(NAME ${example}_scenario COMMAND ${example})
endforeach()
