libavr's guidance binds this repo too, and until now nothing here checked it - `ctest` runs `libavr_format_test()` over this tree's own sources now (rules 11 and 33), skipping rather than passing where clang-format is absent. It caught drift on its first run: a file written this week and edited after formatting. Where the README states a measured size, `libavr_size_claim_test()` holds it to the image and holds the image to the prose: advancing the library pin moved three of these across the fleet with nothing saying so, and re-recording one now requires the sentence that quotes it to move too. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
30 lines
966 B
CMake
30 lines
966 B
CMake
cmake_minimum_required(VERSION 3.28)
|
|
|
|
project(ds3231 LANGUAGES CXX)
|
|
|
|
# libavr rides as the pinned submodule; LIBAVR_ROOT (cache or environment)
|
|
# overrides it for tandem development against a working tree. The toolchain
|
|
# file comes from the submodule via CMakePresets.json either way.
|
|
if(NOT LIBAVR_ROOT AND DEFINED ENV{LIBAVR_ROOT})
|
|
set(LIBAVR_ROOT $ENV{LIBAVR_ROOT})
|
|
endif()
|
|
if(NOT LIBAVR_ROOT)
|
|
set(LIBAVR_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/libavr)
|
|
endif()
|
|
if(NOT EXISTS ${LIBAVR_ROOT}/CMakeLists.txt)
|
|
message(FATAL_ERROR "libavr not found at ${LIBAVR_ROOT} - run: git submodule update --init libavr")
|
|
endif()
|
|
add_subdirectory(${LIBAVR_ROOT} libavr-build)
|
|
|
|
add_library(ds3231 INTERFACE)
|
|
target_include_directories(ds3231 INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
|
target_link_libraries(ds3231 INTERFACE libavr)
|
|
|
|
include(${LIBAVR_ROOT}/cmake/checks.cmake)
|
|
|
|
if(PROJECT_IS_TOP_LEVEL)
|
|
add_subdirectory(example)
|
|
enable_testing()
|
|
add_subdirectory(test)
|
|
endif()
|