cmake -E tar fails to create archive on Windows 10 with "CMake Error: archive_write_header: Can't record entry in tar file without pathname"

c:\work\test_cmake_tar>cmake -E tar c out.tar – file.txt
CMake Error: archive_write_header: Can’t record entry in tar file without pathname
CMake Error: Problem creating tar: out.tar
c:\work\test_cmake_tar>type file.txt
Hi to builting tar archiver
c:\work\test_cmake_tar>cmake --version
cmake version 3.16.3

CMake suite maintained and supported by Kitware (

The - looks like a typo since I doubt you have a file named that. Did you mean to pass that as an argument?