In a project that I know will only be built for the PicoW, I could do this in CMakeLists.txt with all SDK versions prior to 2.0.0:
That is, it worked to set PICO_BOARD before invoking pico_sdk_init(), but after including pico_sdk_import.cmake.
But when I first started testing builds with 2.0.0, I was puzzled to see cmake saying things like this:
And then of course code for a PicoW wouldn't build (networking libraries aren't there).
It turns out that this works:
That is, set PICO_BOARD prior to including pico_sdk_import.cmake. Then the cmake output confirms PICO_BOARD=pico_w, the code builds successfully, and all is well.
Has that change been documented somewhere? If so, then I missed, and sorry for the noise. If not, maybe it should be.
Code:
include(pico_sdk_import.cmake)project(myproject C CXX ASM)# [...]set(PICO_BOARD pico_w)pico_sdk_init()But when I first started testing builds with 2.0.0, I was puzzled to see cmake saying things like this:
Code:
Defaulting platform (PICO_PLATFORM) to 'rp2040' since not specified.Defaulting target board (PICO_BOARD) to 'pico' since not specified.It turns out that this works:
Code:
set(PICO_BOARD pico_w)include(pico_sdk_import.cmake)project(myproject C CXX ASM)# [...]pico_sdk_init()Has that change been documented somewhere? If so, then I missed, and sorry for the noise. If not, maybe it should be.
Statistics: Posted by slimhazard — Wed Sep 11, 2024 7:18 am