Create CMakeLists.txt
A typical C/C++ SDK uses the CMake build automation tool which needs us to create “CMakeLists.txt”, containing the instructions describing the project sources files and targets.
In Visual Studio Code:
Menu > File > New File
Menu > File > Save As > “CMakeLists.txt”
An example to paste this code into the file:
# Set minimum required version of CMake
cmake_minimum_required(VERSION 3.12)
# Include build functions from your SDK
#include($ENV{PICO_SDK_PATH}/external/pico_sdk_import.cmake)
# Set name of project (as PROJECT_NAME) and C/C++ Standards
project(blink-led C CXX ASM)
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
# Point out where to find the executable source file
add_executable(${PROJECT_NAME}
main.c
)
# Pull in our pico_stdlib which pulls in commonly used features (gpio, timer-delay etc)
#target_link_libraries(${PROJECT_NAME}
# mysdk_stdlib
#)
Close and re-open Visual Studio, Explorer > Open Folder > Open your project folder
Feel free to comment if you can add help to this page or point out issues and solutions you have found. I do not provide support on this site, if you need help with a problem head over to stack overflow.