summaryrefslogtreecommitdiff
path: root/Meta/CMake/time_zone_data.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'Meta/CMake/time_zone_data.cmake')
-rw-r--r--Meta/CMake/time_zone_data.cmake13
1 files changed, 9 insertions, 4 deletions
diff --git a/Meta/CMake/time_zone_data.cmake b/Meta/CMake/time_zone_data.cmake
index 86b3d6b581..0d94066f97 100644
--- a/Meta/CMake/time_zone_data.cmake
+++ b/Meta/CMake/time_zone_data.cmake
@@ -40,10 +40,15 @@ set(TZDB_ZONE_1970_PATH "${TZDB_PATH}/${TZDB_ZONE_1970_SOURCE}")
function(extract_tzdb_file source path)
if(EXISTS "${TZDB_ZIP_PATH}" AND NOT EXISTS "${path}")
- message(STATUS "Extracting TZDB ${source} from ${TZDB_ZIP_PATH}...")
- execute_process(COMMAND "${TAR_TOOL}" -C "${TZDB_PATH}" -xzf "${TZDB_ZIP_PATH}" "${source}" RESULT_VARIABLE tar_result)
- if (NOT tar_result EQUAL 0)
- message(FATAL_ERROR "Failed to unzip ${source} from ${TZDB_ZIP_PATH} with status ${tar_result}")
+ if (CMAKE_VERSION VERSION_LESS 3.18.0)
+ message(STATUS "Extracting using ${TAR_TOOL} file ${source}")
+ execute_process(COMMAND "${TAR_TOOL}" -C "${TZDB_PATH}" -xzf "${TZDB_ZIP_PATH}" "${source}" RESULT_VARIABLE tar_result)
+ if (NOT tar_result EQUAL 0)
+ message(FATAL_ERROR "Failed to unzip ${source} from ${TZDB_ZIP_PATH} with status ${tar_result}")
+ endif()
+ else()
+ message(STATUS "Extracting using cmake ${source}")
+ file(ARCHIVE_EXTRACT INPUT "${TZDB_ZIP_PATH}" DESTINATION "${TZDB_PATH}" PATTERNS "${source}")
endif()
endif()
endfunction()