ExternalProject/FetchContent fails for archive with read-only content
Here is a minimal example:
cmake_minimum_required(VERSION 3.11)
project(mdl)
include(FetchContent)
FetchContent_Declare(
mdl
URL "https://developer.nvidia.com/designworks/dl/mdl-sdk-2020.0.1"
)
FetchContent_GetProperties(mdl)
if(NOT mdl_POPULATED)
FetchContent_Populate(mdl)
endif()
Fails with the following error log:
-- Downloading... done
-- extracting...
src='/Users/jedumas/Downloads/cmake-fetchcontent/build/_deps/mdl-subbuild/mdl-populate-prefix/src/archive.tar'
dst='/Users/jedumas/Downloads/cmake-fetchcontent/build/_deps/mdl-src'
-- extracting... [tar xf]
-- extracting... [analysis]
-- extracting... [rename]
CMake Error at mdl-subbuild/mdl-populate-prefix/src/mdl-populate-stamp/extract-mdl-populate.cmake:51 (file):
file RENAME failed to rename
/Users/jedumas/Downloads/cmake-fetchcontent/build/_deps/ex-mdl-populate1234/mdl-sdk-327300.3640
to
/Users/jedumas/Downloads/cmake-fetchcontent/build/_deps/mdl-src
because: Permission denied
make[2]: *** [mdl-populate-prefix/src/mdl-populate-stamp/mdl-populate-download] Error 1
make[1]: *** [CMakeFiles/mdl-populate.dir/all] Error 2
make: *** [all] Error 2
CMake Error at /usr/local/Cellar/cmake/3.17.0_1/share/cmake/Modules/FetchContent.cmake:912 (message):
Build step for mdl failed: 2
Call Stack (most recent call first):
/usr/local/Cellar/cmake/3.17.0_1/share/cmake/Modules/FetchContent.cmake:1003 (__FetchContent_directPopulate)
CMakeLists.txt:12 (FetchContent_Populate)
-- Configuring incomplete, errors occurred!
I'm on macOS with CMake 3.17