Merge pull request #366 from Daft-Freak/patch-1

Improve PIMORONI_PICO_PATH fallback
This commit is contained in:
Philip Howard 2022-05-23 16:10:06 +01:00 committed by GitHub
commit 02f800beb3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 8 deletions

View File

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