-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
37 lines (28 loc) · 1.13 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
cmake_minimum_required(VERSION 3.20)
set(TARGET_GROUP prod CACHE STRING "Target to build for")
if(TARGET_GROUP STREQUAL prod)
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/toolchain.cmake)
message(STATUS "CMAKE_TOOLCHAIN_FILE is: ${CMAKE_TOOLCHAIN_FILE}")
elseif(TARGET_GROUP STREQUAL test)
# do nothing here
else()
message(FATAL_ERROR "Unknown TARGET_GROUP: \"${TARGET_GROUP}\" (can be \"prod\" or \"test\")")
endif()
message(STATUS "TARGET_GROUP is: ${TARGET_GROUP}")
# export compile commands for clang-tidy
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_VERBOSE_MAKEFILE ON)
project(AtmegaTddExample VERSION 0.1.0 DESCRIPTION "ATmega TDD Example" LANGUAGES C)
set(CMAKE_C_STANDARD 11 CACHE STRING "The C standard to use")
set(CMAKE_C_STANDARD_REQUIRED ON)
set(CMAKE_C_EXTENSIONS OFF)
message(STATUS "CMAKE_C_COMPILER is: ${CMAKE_C_COMPILER}")
if(TARGET_GROUP STREQUAL prod)
# set serial port, works under Windows only
set(PORT_NUMBER COM6)
message(STATUS "Serial port set to: ${PORT_NUMBER}")
add_subdirectory(Src Bin)
elseif(TARGET_GROUP STREQUAL test)
enable_testing()
add_subdirectory(Tests)
endif()