Files
anvil/templates/basic/test/CMakeLists.txt.tmpl
Eric Ratliff 3298844399 Anvil v1.0.0 -- Arduino build tool with HAL and test scaffolding
Single-binary CLI that scaffolds testable Arduino projects, compiles,
uploads, and monitors serial output. Templates embed a hardware
abstraction layer, Google Mock infrastructure, and CMake-based host
tests so application logic can be verified without hardware.

Commands: new, doctor, setup, devices, build, upload, monitor
39 Rust tests (21 unit, 18 integration)
Cross-platform: Linux and Windows
2026-02-15 11:16:17 -06:00

48 lines
1.4 KiB
Cheetah

cmake_minimum_required(VERSION 3.14)
project({{PROJECT_NAME}}_tests LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# --------------------------------------------------------------------------
# Google Test (fetched automatically on first build)
# --------------------------------------------------------------------------
include(FetchContent)
FetchContent_Declare(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG v1.14.0
)
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googletest)
enable_testing()
# --------------------------------------------------------------------------
# Include paths -- same headers the Arduino sketch uses
# --------------------------------------------------------------------------
set(LIB_DIR ${CMAKE_SOURCE_DIR}/../lib)
include_directories(
${LIB_DIR}/hal
${LIB_DIR}/app
${CMAKE_SOURCE_DIR}/mocks
)
# --------------------------------------------------------------------------
# Unit tests (Google Mock)
# --------------------------------------------------------------------------
add_executable(test_unit
test_unit.cpp
)
target_link_libraries(test_unit
GTest::gtest_main
GTest::gmock
)
# --------------------------------------------------------------------------
# Register with CTest
# --------------------------------------------------------------------------
include(GoogleTest)
gtest_discover_tests(test_unit)