123456789101112131415161718192021222324252627 |
- # 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)
- # Creates a pico-sdk subdirectory in our project for the libraries
- pico_sdk_init()
- # Set name of project (as PROJECT_NAME) and C/C standards
- project(foo C CXX ASM)
- set(CMAKE_C_STANDARD 11)
- set(CMAKE_CXX_STANDARD 17)
- # Add library information
- add_library(${PROJECT_NAME}
- inc/foo.h
- src/foo.cpp
- )
- # Set local include directories
- target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/inc)
- # Link to external lib pico_stdlib (gpio, time, etc. functions)
- target_link_libraries(${PROJECT_NAME}
- pico_stdlib
- )
|