# STM32 Bootloader Tests - Main CMakeLists.txt
cmake_minimum_required(VERSION 3.22)
project(bootloader_tests C)

set(CMAKE_C_STANDARD 99)
set(CMAKE_C_STANDARD_REQUIRED ON)

# 启用所有警告
if(CMAKE_C_COMPILER_ID MATCHES "GNU|Clang")
    add_compile_options(-Wall -Wextra -Wpedantic)
endif()

# 添加子目录
add_subdirectory(unit)
add_subdirectory(integration)
add_subdirectory(pc_tool)

# 自定义目标：运行所有测试
add_custom_target(run_all_tests
    COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure
    DEPENDS test_crc test_aes test_boot_jump test_protocol test_integration flash_tool
    COMMENT "Running all bootloader tests..."
)

# 注册测试
enable_testing()
