Messy interactions between ExternalProject_Add and cmake -E tar and documentation issues
I have a ExternalProject_Add(... URL http://host/file.deb).
A problem is that, even if you specify DOWNLOAD_NAME, it's ignored. This is because it's first set (https://gitlab.kitware.com/cmake/cmake/-/blob/fbea5d9f9945363f35aa16c3edcf0924e3dc4686/Modules/ExternalProject.cmake#L2761), but then overwritten by https://gitlab.kitware.com/cmake/cmake/-/blob/fbea5d9f9945363f35aa16c3edcf0924e3dc4686/Modules/ExternalProject.cmake#L3053. So, no matter what you do, unless DOWNLOAD_NO_EXTRACT is used, the file is always going to be named "archive.tar".
No big deal, you would say. Unless the file matches one of the supported format (https://gitlab.kitware.com/cmake/cmake/-/blob/fbea5d9f9945363f35aa16c3edcf0924e3dc4686/Modules/ExternalProject.cmake#L3042), the extraction would fail anyway.
The extraction is done with cmake -E tar (https://gitlab.kitware.com/cmake/cmake/-/blob/fbea5d9f9945363f35aa16c3edcf0924e3dc4686/Modules/ExternalProject/extractfile.cmake.in#L32) and a deb file is a https://www.man7.org/linux/man-pages/man1/ar.1.html file, which is not supported by cmake -E tar (https://cmake.org/cmake/help/latest/manual/cmake.1.html#run-a-command-line-tool -> Create or extract a tar or zip archive
). But actually, "cmake -E tar" is able to extract the contents of that .deb file.
So
- ExternalProject_Add acts in a surprising way
- The documentation of cmake -E tar is incomplete
Notice that https://gitlab.kitware.com/cmake/cmake/-/blob/fbea5d9f9945363f35aa16c3edcf0924e3dc4686/Modules/ExternalProject.cmake#L3042 also mentions the "7z" extension. I have not tested it but, if it's supported, Create or extract a tar or zip archive
also fails to mention it.
And by this point, you start to wonder whether "tar" is the best name for a command able to handle so much more than tars.