31 lines
889 B
CMake
31 lines
889 B
CMake
|
|
cmake_minimum_required(VERSION 3.13)
|
||
|
|
|
||
|
|
if(NOT DEFINED LIB_ROOT)
|
||
|
|
set(LIB_ROOT ${CMAKE_SOURCE_DIR}/../..)
|
||
|
|
endif(NOT DEFINED LIB_ROOT)
|
||
|
|
|
||
|
|
set(PICO_SDK_PATH ${LIB_ROOT}/submodules/pico-sdk/)
|
||
|
|
set(PICOTOOL_FETCH_FROM_GIT_PATH ${LIB_ROOT}/submodules/picotool/)
|
||
|
|
|
||
|
|
# Include the Pico SDK (make sure to use the correct path to pico_sdk_import.cmake)
|
||
|
|
include(${LIB_ROOT}/submodules/pico-sdk/external/pico_sdk_import.cmake)
|
||
|
|
|
||
|
|
# Define the project
|
||
|
|
project(ex0_hello_world C CXX ASM)
|
||
|
|
|
||
|
|
# Initialize the Pico SDK
|
||
|
|
pico_sdk_init()
|
||
|
|
|
||
|
|
# Add the executable target (your main C file)
|
||
|
|
add_executable(ex0_hello_world main.c)
|
||
|
|
|
||
|
|
# Link the Pico standard library to the executable
|
||
|
|
target_link_libraries(ex0_hello_world pico_stdlib)
|
||
|
|
|
||
|
|
# Generate additional output formats (like UF2 for flashing)
|
||
|
|
pico_add_extra_outputs(ex0_hello_world)
|
||
|
|
|
||
|
|
pico_enable_stdio_usb(ex0_hello_world 1)
|
||
|
|
pico_enable_stdio_uart(ex0_hello_world 0)
|
||
|
|
|