CMake archive extract syntax
CMake file(ARCHIVE_EXTRACT), is more robust and easy to use than the prior syntax.
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.18)
file(ARCHIVE_EXTRACT ${archive} ${out_dir})
else()
# older, less robust
file(MAKE_DIRECTORY ${out_dir})
execute_process(
COMMAND ${CMAKE_COMMAND} -E tar xf ${archive}
WORKING_DIRECTORY ${out_dir}
RESULT_VARIABLE ret
)
if(NOT ret EQUAL 0)
message(FATAL_ERROR "extract ${archive} => ${out_dir} ${ret}")
endif()
endif()