summaryrefslogtreecommitdiff
path: root/Meta
diff options
context:
space:
mode:
authorTimothy Flynn <trflynn89@pm.me>2021-12-22 16:12:59 -0500
committerLinus Groh <mail@linusgroh.de>2022-01-08 12:45:34 +0100
commitd5f14b5ff9a9a857a27eb1a44ab6c4406136fa59 (patch)
tree1f3ddfd3a5438ec67d3d9c47a10aa389f1ed506c /Meta
parenta70e029236bf1971c96a0a48421292b668be91e9 (diff)
downloadserenity-d5f14b5ff9a9a857a27eb1a44ab6c4406136fa59.zip
Meta: Move remove_unicode_data_if_version_changed to utils.cmake
This function will be used by the time zone database parser. Move it to the common utilities file, and rename it remove_path_if_version_changed to be more generic.
Diffstat (limited to 'Meta')
-rw-r--r--Meta/CMake/unicode_data.cmake23
-rw-r--r--Meta/CMake/utils.cmake17
2 files changed, 21 insertions, 19 deletions
diff --git a/Meta/CMake/unicode_data.cmake b/Meta/CMake/unicode_data.cmake
index 2d71f78fe4..ee7bf9f4bf 100644
--- a/Meta/CMake/unicode_data.cmake
+++ b/Meta/CMake/unicode_data.cmake
@@ -1,3 +1,5 @@
+include(${CMAKE_CURRENT_LIST_DIR}/utils.cmake)
+
set(UCD_VERSION 14.0.0)
set(CLDR_VERSION 40.0.0)
@@ -67,23 +69,6 @@ set(CLDR_NUMBERS_PATH "${CLDR_PATH}/${CLDR_NUMBERS_SOURCE}")
set(CLDR_UNITS_SOURCE cldr-units-modern)
set(CLDR_UNITS_PATH "${CLDR_PATH}/${CLDR_UNITS_SOURCE}")
-function(remove_unicode_data_if_version_changed version version_file cache_path)
- set(version_differs YES)
-
- if (EXISTS "${version_file}")
- file(STRINGS "${version_file}" active_version)
- if (version STREQUAL active_version)
- set(version_differs NO)
- endif()
- endif()
-
- if (version_differs)
- message(STATUS "Removing outdated ${cache_path} for version ${version}")
- file(REMOVE_RECURSE "${cache_path}")
- file(WRITE "${version_file}" "${version}")
- endif()
-endfunction()
-
function(download_ucd_file url path)
if (NOT EXISTS "${path}")
get_filename_component(file "${path}" NAME)
@@ -120,8 +105,8 @@ function(invoke_generator name generator header implementation)
endfunction()
if (ENABLE_UNICODE_DATABASE_DOWNLOAD)
- remove_unicode_data_if_version_changed("${UCD_VERSION}" "${UCD_VERSION_FILE}" "${UCD_PATH}")
- remove_unicode_data_if_version_changed("${CLDR_VERSION}" "${CLDR_VERSION_FILE}" "${CLDR_PATH}")
+ remove_path_if_version_changed("${UCD_VERSION}" "${UCD_VERSION_FILE}" "${UCD_PATH}")
+ remove_path_if_version_changed("${CLDR_VERSION}" "${CLDR_VERSION_FILE}" "${CLDR_PATH}")
download_ucd_file("${UNICODE_DATA_URL}" "${UNICODE_DATA_PATH}")
download_ucd_file("${SPECIAL_CASING_URL}" "${SPECIAL_CASING_PATH}")
diff --git a/Meta/CMake/utils.cmake b/Meta/CMake/utils.cmake
index 6783ee1277..9f48a64e1b 100644
--- a/Meta/CMake/utils.cmake
+++ b/Meta/CMake/utils.cmake
@@ -158,3 +158,20 @@ function(link_with_unicode_data target)
target_link_libraries("${target}" LibUnicodeData)
endif()
endfunction()
+
+function(remove_path_if_version_changed version version_file cache_path)
+ set(version_differs YES)
+
+ if (EXISTS "${version_file}")
+ file(STRINGS "${version_file}" active_version)
+ if (version STREQUAL active_version)
+ set(version_differs NO)
+ endif()
+ endif()
+
+ if (version_differs)
+ message(STATUS "Removing outdated ${cache_path} for version ${version}")
+ file(REMOVE_RECURSE "${cache_path}")
+ file(WRITE "${version_file}" "${version}")
+ endif()
+endfunction()