-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
55 lines (45 loc) · 1.24 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
cmake_minimum_required(VERSION 3.15)
project(xmega-hal
DESCRIPTION "Demo project for generic c++17 hal/bsp"
LANGUAGES C CXX )
add_executable(${PROJECT_NAME} main.cpp)
add_subdirectory(bsp)
target_sources(${PROJECT_NAME}
PUBLIC
)
target_link_libraries(${PROJECT_NAME}
PUBLIC
avr::bsp
)
target_compile_features(${PROJECT_NAME}
PUBLIC
cxx_std_17
)
target_compile_options(${PROJECT_NAME}
PUBLIC
"-fno-exceptions"
"-fno-rtti"
"-funsigned-char"
"-funsigned-bitfields"
"-Wall"
)
#set_property(TARGET ${PROJECT_NAME} PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
if(NOT SIMULATION_BUILD)
# all post build steps in a generic file. Include after add_executable!
include(scripts/avr-gcc.cmake)
target_compile_options(${PROJECT_NAME}
PUBLIC
$<$<CONFIG:Debug>:-O1> # avr delay doesn't work with no optimization
"-fpack-struct"
"-fshort-enums"
)
target_link_options(${PROJECT_NAME}
INTERFACE
#"-Wl,-u,vfprintf -lprintf_flt -lm" # if we want flaoting point support from avr-libc
)
else()
target_compile_options(${PROJECT_NAME}
PUBLIC
)
endif()