mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:57:35 +00:00
Meta: Use CMake functions to extract files
Newer cmake's have internal functions to un-compress files. These functions will work on pure windows - as well as linux. This eliminates the need to search for external tools (TAR,GZIP,ZIP) - and helps fixing #9866. In order to finally fix #9866 we need to decide to bump the cmake version requirements and remove the checks. If we demand a newer cmake version, we will loose Ubuntu 20.04 as a build target - as it ships with CMake 3.16. For now - we keep compatibility with CMake 3.16 - and only if CMake 3.18 as been found - we use its new functionality.
This commit is contained in:
parent
5ab3fcf710
commit
8b30b69dac
4 changed files with 45 additions and 22 deletions
|
@ -224,10 +224,15 @@ endfunction()
|
|||
|
||||
function(extract_path dest_dir zip_path source_path dest_path)
|
||||
if (EXISTS "${zip_path}" AND NOT EXISTS "${dest_path}")
|
||||
message(STATUS "Extracting ${source_path} from ${zip_path}")
|
||||
execute_process(COMMAND "${UNZIP_TOOL}" -q "${zip_path}" "${source_path}" -d "${dest_dir}" RESULT_VARIABLE unzip_result)
|
||||
if (NOT unzip_result EQUAL 0)
|
||||
message(FATAL_ERROR "Failed to unzip ${source_path} from ${zip_path} with status ${unzip_result}")
|
||||
if (CMAKE_VERSION VERSION_LESS 3.18.0)
|
||||
message(STATUS "Extracting using ${UNZIP_TOOL} ${source_path} from ${zip_path}")
|
||||
execute_process(COMMAND "${UNZIP_TOOL}" -q "${zip_path}" "${source_path}" -d "${dest_dir}" RESULT_VARIABLE unzip_result)
|
||||
if (NOT unzip_result EQUAL 0)
|
||||
message(FATAL_ERROR "Failed to unzip ${source_path} from ${zip_path} with status ${unzip_result}")
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "Extracting using cmake ${source_path}")
|
||||
file(ARCHIVE_EXTRACT INPUT "${zip_path}" DESTINATION "${dest_dir}" PATTERNS "${source_path}")
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue