I am trying to compress a directory as .tar.xz under Windows with CMake tools.
I want the following three things with priority in that order of importance:
- The root directory of the
tarshould be different from my working directory. - Use maximum number of threads to speed up the compression.
- Set the compression level.
I have found three ways to realize this:
- CMake
fileARCHIVE_EXTRACTstatement- ❌ Can not set working directory (➕ workaround possible by sub-script call via
execute_process) - ❌ No multithreading support
- ✅ Can set compression level
- ❌ Can not set working directory (➕ workaround possible by sub-script call via
- CMake
tarcommand viaexecute_process- ✅ Can set working directory (by
execute_process) - ❌ No multithreading support
- ❌ Can not set compression level
- ✅ Can set working directory (by
- CPack via
execute_process- ✅ Hopefully can set working directory (by
execute_process?) - ✅ Hopefully can enable multithreading support by
CPACK_ARCHIVE_THREADSorCPACK_THREADS? - ❌ Nothing found.
- ✅ Hopefully can set working directory (by
The first point I can apparently implement with any of these approaches. Multithreading seems to be possible only with the CPack approach.
Unfortunately I did not manage to implement the approach via cpack.
Is there any way to fulfill all three points or at least the first two ones?