diff --git a/external/pico_sdk_import.cmake b/external/pico_sdk_import.cmake index a0721d0d1..d625cdff3 100644 --- a/external/pico_sdk_import.cmake +++ b/external/pico_sdk_import.cmake @@ -40,25 +40,40 @@ if (NOT PICO_SDK_PATH) if (PICO_SDK_FETCH_FROM_GIT_PATH) get_filename_component(FETCHCONTENT_BASE_DIR "${PICO_SDK_FETCH_FROM_GIT_PATH}" REALPATH BASE_DIR "${CMAKE_SOURCE_DIR}") endif () - # GIT_SUBMODULES_RECURSE was added in 3.17 - if (${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.17.0") - FetchContent_Declare( - pico_sdk - GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk - GIT_TAG ${PICO_SDK_FETCH_FROM_GIT_TAG} - GIT_SUBMODULES_RECURSE FALSE - ) - else () - FetchContent_Declare( - pico_sdk - GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk - GIT_TAG ${PICO_SDK_FETCH_FROM_GIT_TAG} - ) - endif () + FetchContent_Declare( + pico_sdk + GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk + GIT_TAG ${PICO_SDK_FETCH_FROM_GIT_TAG} + ) if (NOT pico_sdk) message("Downloading Raspberry Pi Pico SDK") - FetchContent_Populate(pico_sdk) + # GIT_SUBMODULES_RECURSE was added in 3.17 + if (${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.17.0") + FetchContent_Populate( + pico_sdk + QUIET + GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk + GIT_TAG ${PICO_SDK_FETCH_FROM_GIT_TAG} + GIT_SUBMODULES_RECURSE FALSE + + SOURCE_DIR ${FETCHCONTENT_BASE_DIR}/pico_sdk-src + BINARY_DIR ${FETCHCONTENT_BASE_DIR}/pico_sdk-build + SUBBUILD_DIR ${FETCHCONTENT_BASE_DIR}/pico_sdk-subbuild + ) + else () + FetchContent_Populate( + pico_sdk + QUIET + GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk + GIT_TAG ${PICO_SDK_FETCH_FROM_GIT_TAG} + + SOURCE_DIR ${FETCHCONTENT_BASE_DIR}/pico_sdk-src + BINARY_DIR ${FETCHCONTENT_BASE_DIR}/pico_sdk-build + SUBBUILD_DIR ${FETCHCONTENT_BASE_DIR}/pico_sdk-subbuild + ) + endif () + set(PICO_SDK_PATH ${pico_sdk_SOURCE_DIR}) endif () set(FETCHCONTENT_BASE_DIR ${FETCHCONTENT_BASE_DIR_SAVE}) diff --git a/tools/Findpicotool.cmake b/tools/Findpicotool.cmake index e7ecbcea9..e5bfaeaac 100644 --- a/tools/Findpicotool.cmake +++ b/tools/Findpicotool.cmake @@ -15,10 +15,12 @@ if (NOT TARGET picotool) endif () include(FetchContent) - set(FETCHCONTENT_BASE_DIR_SAVE ${FETCHCONTENT_BASE_DIR}) if (PICOTOOL_FETCH_FROM_GIT_PATH) - get_filename_component(FETCHCONTENT_BASE_DIR "${PICOTOOL_FETCH_FROM_GIT_PATH}" ABSOLUTE) + get_filename_component(picotool_INSTALL_DIR "${PICOTOOL_FETCH_FROM_GIT_PATH}" ABSOLUTE) + else () + get_filename_component(picotool_INSTALL_DIR "${FETCHCONTENT_BASE_DIR}" ABSOLUTE) endif () + set(picotool_INSTALL_DIR ${picotool_INSTALL_DIR} CACHE PATH "Directory where picotool has been installed" FORCE) set(picotool_BUILD_TARGET picotoolBuild) set(picotool_TARGET picotool) @@ -32,20 +34,15 @@ if (NOT TARGET picotool) ) endif() - FetchContent_Declare( - picotool - GIT_REPOSITORY https://github.com/raspberrypi/picotool.git - GIT_TAG develop - GIT_PROGRESS true - ) + message("Downloading Picotool") + FetchContent_Populate(picotool QUIET + GIT_REPOSITORY https://github.com/raspberrypi/picotool.git + GIT_TAG develop - FetchContent_GetProperties(picotool) - set(picotool_INSTALL_DIR ${FETCHCONTENT_BASE_DIR} CACHE PATH "Directory where picotool has been installed" FORCE) - if (NOT picotool_POPULATED) - message("Downloading Picotool") - FetchContent_Populate(picotool) - endif () - set(FETCHCONTENT_BASE_DIR ${FETCHCONTENT_BASE_DIR_SAVE}) + SOURCE_DIR ${picotool_INSTALL_DIR}/picotool-src + BINARY_DIR ${picotool_INSTALL_DIR}/picotool-build + SUBBUILD_DIR ${picotool_INSTALL_DIR}/picotool-subbuild + ) add_custom_target(picotoolForceReconfigure ${CMAKE_COMMAND} -E touch_nocreate "${CMAKE_SOURCE_DIR}/CMakeLists.txt"