Hello all,
I want to make my own Pico SDK libraries available through a private vcpkg repository, so that I can automate all the setup involved in installing and updating libraries in my projects. It seems that the vcpkg setup itself won't be very hard, but I'm having a hard time setting up CMake, and there doesn't seem to be any resource out there on how to properly set up such a project.
What I want is to set up a CMake project for each library, such that all Pico SDK dependencies are imported and recognized by CLion. Those projects will then be added as a port to my vcpkg repository, so that I can automatically set up libraries as needed in my executable projects.
Currently, I'm having trouble that that first part. I tried looking at the libraries in the sticky post, and others that I could find on the internet, but they're all very inconsistent in how they write their CMakeLists.txt files, and the SDK documentation doesn't really explain how it should be done either.
Currently, my CMakeLists.txt file looks similar to this (simplified for brevity):
This runs fine, but CLion does not recognize any Pico SDK files. Because of that, any source files that use the SDK throw a million errors in the code editor.
So, how should I configure CMake to make proper C++ libraries using the SDK in this way?
I want to make my own Pico SDK libraries available through a private vcpkg repository, so that I can automate all the setup involved in installing and updating libraries in my projects. It seems that the vcpkg setup itself won't be very hard, but I'm having a hard time setting up CMake, and there doesn't seem to be any resource out there on how to properly set up such a project.
What I want is to set up a CMake project for each library, such that all Pico SDK dependencies are imported and recognized by CLion. Those projects will then be added as a port to my vcpkg repository, so that I can automatically set up libraries as needed in my executable projects.
Currently, I'm having trouble that that first part. I tried looking at the libraries in the sticky post, and others that I could find on the internet, but they're all very inconsistent in how they write their CMakeLists.txt files, and the SDK documentation doesn't really explain how it should be done either.
Currently, my CMakeLists.txt file looks similar to this (simplified for brevity):
Code:
include($ENV{PICO_SDK_PATH}/external/pico_sdk_import.cmake)set(LIBRARY_NAME <lib-name>)project(${LIBRARY_NAME} LANGUAGES C CXX ASM VERSION 1.0.0)set(CMAKE_CXX_STANDARD 26)pico_sdk_init()add_library(${LIBRARY_NAME} INTERFACE)target_link_libraries(${LIBRARY_NAME} INTERFACE <pico-libraries>)target_sources(${LIBRARY_NAME} INTERFACE <headers-files> <cpp-files>)So, how should I configure CMake to make proper C++ libraries using the SDK in this way?
Statistics: Posted by suprjd — Thu Jun 12, 2025 3:37 pm