-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
39 lines (32 loc) · 1 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
38
39
cmake_minimum_required(VERSION 3.10)
project(tdd_cpp VERSION 1.0)
set(DEV_BUILD
ON
CACHE BOOL "Developer build: ON or OFF")
set(CMAKE_BUILD_TYPE
RelWithDebInfo
CACHE STRING "Build type: Debug, Release, RelWithDebInfo or MinSizeRel")
include(cmake/misc/optimizations.cmake)
include(cmake/misc/warnings.cmake)
include(cmake/misc/standard.cmake)
include(cmake/misc/exec_postbuild.cmake)
# HAL: hardware abstraction layer.
if(CMAKE_SYSTEM_PROCESSOR STREQUAL arm)
add_subdirectory(hal/arm)
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL avr)
add_subdirectory(hal/avr)
else()
add_subdirectory(hal/os)
endif()
# Embedded application library: add header and source files.
add_library(embedded include/embedded.h src/embedded.c)
target_include_directories(embedded PUBLIC include)
target_link_libraries(embedded PRIVATE hal)
# Main for Embedded (infinite loop).
add_executable(main src/main.c)
target_link_libraries(main PRIVATE embedded)
# Tests.
if(DEV_BUILD)
enable_testing()
add_subdirectory(tests)
endif()