@@ -15,10 +15,12 @@ if (NOT TARGET picotool)
1515    endif  ()
1616
1717    include (FetchContent)
18-     set (FETCHCONTENT_BASE_DIR_SAVE ${FETCHCONTENT_BASE_DIR} )
1918    if  (PICOTOOL_FETCH_FROM_GIT_PATH)
20-         get_filename_component (FETCHCONTENT_BASE_DIR "${PICOTOOL_FETCH_FROM_GIT_PATH} "  ABSOLUTE )
19+         get_filename_component (picotool_INSTALL_DIR "${PICOTOOL_FETCH_FROM_GIT_PATH} "  ABSOLUTE )
20+     else  ()
21+         get_filename_component (picotool_INSTALL_DIR "${FETCHCONTENT_BASE_DIR} "  ABSOLUTE )
2122    endif  ()
23+     set (picotool_INSTALL_DIR ${picotool_INSTALL_DIR}  CACHE  PATH  "Directory where picotool has been installed"  FORCE)
2224
2325    set (picotool_BUILD_TARGET picotoolBuild)
2426    set (picotool_TARGET picotool)
@@ -32,20 +34,15 @@ if (NOT TARGET picotool)
3234            )
3335        endif ()
3436
35-         FetchContent_Declare(
36-                 picotool
37-                 GIT_REPOSITORY https://github.com/raspberrypi/picotool.git
38-                 GIT_TAG develop
39-                 GIT_PROGRESS true 
40-         )
37+         message ("Downloading Picotool" )
38+         FetchContent_Populate(picotool QUIET 
39+             GIT_REPOSITORY https://github.com/raspberrypi/picotool.git
40+             GIT_TAG develop
4141
42-         FetchContent_GetProperties(picotool)
43-         set (picotool_INSTALL_DIR ${FETCHCONTENT_BASE_DIR}  CACHE  PATH  "Directory where picotool has been installed"  FORCE)
44-         if  (NOT  picotool_POPULATED)
45-             message ("Downloading Picotool" )
46-             FetchContent_Populate(picotool)
47-         endif  ()
48-         set (FETCHCONTENT_BASE_DIR ${FETCHCONTENT_BASE_DIR_SAVE} )
42+             SOURCE_DIR ${picotool_INSTALL_DIR} /picotool-src
43+             BINARY_DIR ${picotool_INSTALL_DIR} /picotool-build 
44+             SUBBUILD_DIR ${picotool_INSTALL_DIR} /picotool-subbuild
45+         )
4946
5047        add_custom_target (picotoolForceReconfigure
5148            ${CMAKE_COMMAND}  -E touch_nocreate "${CMAKE_SOURCE_DIR} /CMakeLists.txt" 
0 commit comments