Improve PIMORONI_PICO_PATH fallback

Check for pimoroni-pico next to the pico sdk, then next to the project. If neither exist, fail with an error that tells the user to set PIMORONI_PICO_PATH.
pull/366/head
Charlie Birks 2022-05-21 12:05:49 +01:00 zatwierdzone przez GitHub
rodzic db60553322
commit 54551c3f94
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
1 zmienionych plików z 9 dodań i 8 usunięć

Wyświetl plik

@ -2,16 +2,17 @@
# It will also set up the required include and module search paths. # It will also set up the required include and module search paths.
if (NOT PIMORONI_PICO_PATH) if (NOT PIMORONI_PICO_PATH)
set(PIMORONI_PICO_PATH "../../pimoroni-pico/") if (PICO_SDK_PATH AND EXISTS "${PICO_SDK_PATH}/../pimoroni-pico")
endif() set(PIMORONI_PICO_PATH ${PICO_SDK_PATH}/../pimoroni-pico)
message("Defaulting PIMORONI_PICO_PATH as sibling of PICO_SDK_PATH: ${PIMORONI_PICO_PATH}")
if(NOT IS_ABSOLUTE ${PIMORONI_PICO_PATH}) elseif(EXISTS "${CMAKE_CURRENT_BINARY_DIR}/../../pimoroni-pico/")
get_filename_component( set(PIMORONI_PICO_PATH ${CMAKE_CURRENT_BINARY_DIR}/../../pimoroni-pico/)
PIMORONI_PICO_PATH else()
"${CMAKE_CURRENT_BINARY_DIR}/${PIMORONI_PICO_PATH}" message(FATAL_ERROR "Pimoroni Pico location was not specified. Please set PIMORONI_PICO_PATH.")
ABSOLUTE) endif()
endif() endif()
get_filename_component(PIMORONI_PICO_PATH "${PIMORONI_PICO_PATH}" REALPATH BASE_DIR "${CMAKE_BINARY_DIR}")
if (NOT EXISTS ${PIMORONI_PICO_PATH}) if (NOT EXISTS ${PIMORONI_PICO_PATH})
message(FATAL_ERROR "Directory '${PIMORONI_PICO_PATH}' not found") message(FATAL_ERROR "Directory '${PIMORONI_PICO_PATH}' not found")
endif () endif ()