Files
templates/c/ds18b20/CMakeLists.txt

38 lines
1.1 KiB
CMake
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
cmake_minimum_required(VERSION 3.13)
project(ds18b20 C)
set(CMAKE_C_STANDARD 99)
set(CMAKE_C_STANDARD_REQUIRED ON)
# Переносимое ядро: ни регистров, ни задержек, ни stm32f10x.h.
add_library(ds18b20 STATIC
src/onewire.c
src/ds18b20.c
)
target_include_directories(ds18b20 PUBLIC include)
if(MSVC)
target_compile_options(ds18b20 PRIVATE /W4)
else()
target_compile_options(ds18b20 PRIVATE -Wall -Wextra -Wpedantic)
endif()
# Порты (ports/) сюда не входят: им нужен CMSIS-заголовок целевого МК,
# они подключаются напрямую в проект прошивки.
option(DS18B20_BUILD_TESTS "Собирать тесты на симуляторе шины" ON)
if(DS18B20_BUILD_TESTS)
enable_testing()
add_executable(test_ds18b20
tests/test_ds18b20.c
tests/fake_onewire.c
)
target_link_libraries(test_ds18b20 PRIVATE ds18b20)
target_include_directories(test_ds18b20 PRIVATE tests)
add_test(NAME ds18b20 COMMAND test_ds18b20)
endif()
add_subdirectory(instance)