-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
38 lines (36 loc) · 1.66 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
cmake_minimum_required(VERSION 3.22)
## Project configuration
set(PROJECT_NAME "pico-boilerplate")
set(PROJECT_VERSION "0.0.1")
set(PICO_BOARD "pico_w")
set(USE_STDIO_USB 1)
set(USE_STDIO_UART 0)
set(OUTPUT_NAME "output")
## Default setup
set(${PROJECT_NAME}_ENTRYPOINT ${CMAKE_CURRENT_LIST_DIR}/main.cpp) # default entrypoint
set(${PROJECT_NAME}_INCLUDE_DIR ${CMAKE_CURRENT_LIST_DIR}/include)
set(${PROJECT_NAME}_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/src)
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
set(PICO_SDK_FETCH_FROM_GIT on)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/version.hpp.in" "_generated/version.hpp")
add_compile_options(-Wall -Wno-format -Wno-unused-function -Wno-maybe-uninitialized)
include(${CMAKE_CURRENT_LIST_DIR}/cmake/pico_sdk_import.cmake)
project(${PROJECT_NAME} C CXX ASM)
pico_sdk_init()
set(CMAKE_C_COMPILER arm-none-eabi-gcc)
set(CMAKE_CXX_COMPILER arm-none-eabi-g++)
file(GLOB_RECURSE ${${PROJECT_NAME}_SOURCES} ${${PROJECT_NAME}_SOURCE_DIR}/*.cpp)
add_executable(${PROJECT_NAME} ${${PROJECT_NAME}_ENTRYPOINT} ${${PROJECT_NAME}_SOURCES})
target_include_directories(${PROJECT_NAME} PRIVATE ${${PROJECT_NAME}_INCLUDE_DIR}
${CMAKE_CURRENT_BINARY_DIR}/_generated)
target_link_libraries(${PROJECT_NAME} pico_stdlib)
if (PICO_CYW43_SUPPORTED)
add_compile_definitions(WIFI)
target_link_libraries(${PROJECT_NAME} pico_cyw43_arch_none)
endif ()
set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME ${OUTPUT_NAME})
pico_enable_stdio_usb(${PROJECT_NAME} ${USE_STDIO_USB})
pico_enable_stdio_uart(${PROJECT_NAME} ${USE_STDIO_UART})
pico_add_extra_outputs(${PROJECT_NAME})