Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 7060

SDK • Cmake Variables not available after FetchContent

$
0
0
Hi!
I ran into the following problem: when using pico_sdk with FetchContent in cmake, some variables are not availabe. I noticed that because pico_add_uf2_output fails since PICO_SDK_VERSION_MAJOR, PICO_SDK_VERSION_MINOR and PICO_SDK_VERSION_REVISION are empty.
A minimal example for CMakeLists.txt looks like this:

Code:

cmake_minimum_required(VERSION 3.22)include(FetchContent)FetchContent_Declare(pico_sdkGIT_REPOSITORY https://github.com/raspberrypi/pico-sdkGIT_TAG master)FetchContent_MakeAvailable(pico_sdk)message(VERSION_REVISION="${PICO_SDK_VERSION_REVISION}")
Which outputs VERSION_REVISION=""

I can verify that the variables are set when the files are included (in pico_sdk_init.cmake and pico_sdk_version.cmake), but after the FetchContent_MakeAvailable() call, they are not available.
It might be related to a cmake update from version 3.16 to 3.22, but I am not sure about that.

Is there something obvious I am missing?

Statistics: Posted by Pizui — Fri Feb 09, 2024 8:21 pm — Replies 0 — Views 19



Viewing all articles
Browse latest Browse all 7060

Trending Articles