-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
44 lines (37 loc) · 1.19 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
# Just a recent number
cmake_minimum_required(VERSION 3.18)
# Use AVR GCC toolchain definition in your HOME/Arduino directory
if(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Linux")
set(ARDUINO_PATH $ENV{HOME}/Arduino)
set(AVR_PORT /dev/ttyACM0)
elseif(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Windows")
set(ARDUINO_PATH "$ENV{HOMEDRIVE}$ENV{HOMEPATH}/Arduino")
set(AVR_PORT COM6)
endif()
# the toolchain to use
set(CMAKE_TOOLCHAIN_FILE ${ARDUINO_PATH}/etc/toolchain-avr.cmake)
# include standard extra targets, like 'upload'
set(CMAKE_PROJECT_INCLUDE ${ARDUINO_PATH}/etc/extratargets-avr.cmake)
# Project name
project("KBS")
# Create one target
# (Linux) `find src -name \*.c\*`
add_executable(${PROJECT_NAME}
src/main.cpp
)
target_include_directories(${PROJECT_NAME} PRIVATE
"${ARDUINO_PATH}/include/arduino"
"${CMAKE_CURRENT_SOURCE_DIR}/include"
"${CMAKE_CURRENT_SOURCE_DIR}/src"
)
target_link_directories(${PROJECT_NAME} PRIVATE
"${ARDUINO_PATH}/lib"
)
target_link_libraries(${PROJECT_NAME}
Wire
Nunchuk
SPI
ArduinoCore
)
# Rename the output to .elf as we will create multiple files
set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME ${PROJECT_NAME}.elf)