我正在尝试使用 CMake 3.28.3 配置项目。
CMakeLists.txt
包含以下内容:
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)
现在,我已经验证存档文件状况良好,并且
tar xvfz
工作正常。这也有效:
cmake -E tar "xvf" cuda-api-wrappers-0.8.0-rc1.tar.gz
没有问题。然而,当使用 CMake 配置时,我收到错误:
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)
为什么会发生这种情况?是我这边的问题,还是 CMake 的 bug?
编辑: 使用 CMake 3.31.2 尝试过此操作,行为相同。
这是网址末尾的逗号:
/home/joeuser/foo/third_party/cuda-api-wrappers-0.8.0-rc1.tar.gz,
应该是:
/home/joeuser/foo/third_party/cuda-api-wrappers-0.8.0-rc1.tar.gz