1234567891011121314151617181920212223242526272829303132333435363738 |
- # Set minimum required version of CMake
- cmake_minimum_required(VERSION 3.12)
- # Include build functions from Pico SDK
- include($ENV{PICO_SDK_PATH}/external/pico_sdk_import.cmake)
- # Set name of project (as PROJECT_NAME) and C/C standards
- project(blink C CXX ASM)
- set(CMAKE_C_STANDARD 11)
- set(CMAKE_CXX_STANDARD 17)
- # Creates a pico-sdk subdirectory in our project for the libraries
- pico_sdk_init()
- # Tell CMake where to find the executable source file
- add_executable(${PROJECT_NAME}
- src/main.cpp
- )
- # Create map/bin/hex/uf2 files
- pico_add_extra_outputs(${PROJECT_NAME})
- # Add local folder with libs
- add_subdirectory(libs/foo)
- # Set local include directories
- target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_SOURCE_DIR}/inc)
- # Link to external lib pico_stdlib (gpio, time, etc. functions) and internal lib
- target_link_libraries(${PROJECT_NAME}
- pico_stdlib
- foo
- )
- # Enable usb output, disable uart output
- pico_enable_stdio_usb(${PROJECT_NAME} 0)
- pico_enable_stdio_uart(${PROJECT_NAME} 1)
|