1 # This is a copy of <PICO_SDK_PATH>/external/pico_sdk_import.cmake
3 # This can be dropped into an external project to help locate this SDK
4 # It should be include()ed prior to project()
6 if (DEFINED ENV{PICO_SDK_PATH} AND (NOT PICO_SDK_PATH))
7 set(PICO_SDK_PATH $ENV{PICO_SDK_PATH})
8 message("Using PICO_SDK_PATH from environment ('${PICO_SDK_PATH}')")
11 set(PICO_SDK_PATH "${PICO_SDK_PATH}" CACHE PATH "Path to the Raspberry Pi Pico SDK")
13 if (NOT PICO_SDK_PATH)
14 message(FATAL_ERROR "SDK location was not specified. Please set PICO_SDK_PATH.")
17 get_filename_component(PICO_SDK_PATH "${PICO_SDK_PATH}" REALPATH BASE_DIR "${CMAKE_BINARY_DIR}")
18 if (NOT EXISTS ${PICO_SDK_PATH})
19 message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' not found")
22 set(PICO_SDK_INIT_CMAKE_FILE ${PICO_SDK_PATH}/pico_sdk_init.cmake)
23 if (NOT EXISTS ${PICO_SDK_INIT_CMAKE_FILE})
24 message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' does not appear to contain the Raspberry Pi Pico SDK")
27 set(PICO_SDK_PATH ${PICO_SDK_PATH} CACHE PATH "Path to the Raspberry Pi Pico SDK" FORCE)
29 include(${PICO_SDK_INIT_CMAKE_FILE})