1

Background:
I am writing C++ code for the Pico on Windows using VS Code and CMake.

What was working before:
I have been writing programs successfully using the recommended directory structure:

+ My_Project_1
+ My_Project_2
+ pico-sdk

Inside each My_Project_* folder is a CMakeLists.txt file, and a copy of pico_sdk_import.cmake.

What did I change:
I changed to this structure. Just collecting my projects into their own parent folder, which itself it parallel to pico-sdk.

+ My_Projects
    + My_Project_1
    + My_Project_2
+ pico-sdk

My Problem
When I try to configure one of the projects, I get an error message from the pico_sdk_import.cmake file:

[cmake] CMake Error at pico_sdk_import.cmake:65 (message):
[cmake]   Directory 'D:/My_Projects/pico-sdk'
[cmake]   not found

I am not super familiar with CMake, and I can't seem to work out what I need to change to get this to work. Presumably this directory D:/My_Projects/pico-sdk should actually be D:/pico-sdk.

Question:
What can I change in my CMakeLists.txt file to tell CMake that my project folder is one folder deeper?

Please note that I've just simplified the directory names for this question.pico-sdk is not really in the root of my D: drive.

1 Answer 1

1

The environment variable PICO_SDK_PATH must be set to the location of pico-sdk (in your case to "D:/pico-sdk") before calling cmake.

You can set this variable in the "Edit environment variables for your account" window in Windows 10 (it appears in the start menu from just searching for "Path"). Once set, reopen the terminal or IDE, and recompile with cmake.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.