1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 14:28:12 +00:00

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.
This commit is contained in:
Timothy Flynn 2021-12-22 16:12:59 -05:00 committed by Linus Groh
parent a70e029236
commit d5f14b5ff9
2 changed files with 21 additions and 19 deletions

View file

@ -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()