I'm trying to configure a project using CMake 3.28.3. The CMakeLists.txt
contains the following:
include(FetchContent)
FetchContent_Declare(
cuda-api-wrappers
URL ${CMAKE_CURRENT_SOURCE_DIR}/third_party/cuda-api-wrappers-0.8.0-rc1.tar.gz,
URL_HASH MD5=463d41c3777115ecf3375d8f45c10d92
OVERRIDE_FIND_PACKAGE
)
find_package(cuda-api-wrappers REQUIRED)
Now, I've verified the archive file is in good condition and tar xvfz
on it works fine. This also works:
cmake -E tar "xvf" cuda-api-wrappers-0.8.0-rc1.tar.gz
with no problem. Yet, when configuring using CMake, I'm getting the error:
CMake Error at /opt/versions/cmake/3.28.3/share/cmake-3.28/Modules/ExternalProject.cmake:1672 (message):
Do not know how to extract
'/home/joeuser/foo/third_party/cuda-api-wrappers-0.8.0-rc1.tar.gz,'
-- known types are: .7z, .tar, .tar.bz2, .tar.gz, .tar.xz, .tbz2, .tgz,
.txz and .zip
Call Stack (most recent call first):
/opt/versions/cmake/3.28.3/share/cmake-3.28/Modules/ExternalProject.cmake:3219 (_ep_write_extractfile_script)
/opt/versions/cmake/3.28.3/share/cmake-3.28/Modules/ExternalProject.cmake:4418 (_ep_add_download_command)
CMakeLists.txt:21 (ExternalProject_Add)
-- Configuring incomplete, errors occurred!
CMake Error at /opt/versions/cmake/3.28.3/share/cmake-3.28/Modules/FetchContent.cmake:1667 (message):
CMake step for cuda-api-wrappers failed: 1
Call Stack (most recent call first):
/opt/versions/cmake/3.28.3/share/cmake-3.28/Modules/FetchContent.cmake:1819:EVAL:2 (__FetchContent_directPopulate)
/opt/versions/cmake/3.28.3/share/cmake-3.28/Modules/FetchContent.cmake:1819 (cmake_language)
/opt/versions/cmake/3.28.3/share/cmake-3.28/Modules/FetchContent.cmake:2033 (FetchContent_Populate)
CMakeLists.txt
CMakeLists.txt:39 (find_package)
Why is this happening? Is it a problem on my side, or a CMake bug?
Edit: Tried this with CMake 3.31.2, same behavior.
It was the comma at the end of the URL:
/home/joeuser/foo/third_party/cuda-api-wrappers-0.8.0-rc1.tar.gz,
should be:
/home/joeuser/foo/third_party/cuda-api-wrappers-0.8.0-rc1.tar.gz
but the error message about "not knowing how to decompress" really threw me off! I would have expected a "file not found" or "nothing at the URL" or something.
... so I've filed a bug about this with Kitware.