1 Star 0 Fork 0

kumo-pub/kmpkg

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
kmpkg_replace_string.cmake 812 Bytes
一键复制 编辑 原始数据 按行查看 历史
李寅斌 提交于 2024-08-26 00:24 +08:00 . init
function(kmpkg_replace_string filename match replace)
cmake_parse_arguments(PARSE_ARGV 3 "arg" "REGEX;IGNORE_UNCHANGED" "" "")
if(arg_REGEX)
set(arg_REGEX "REGEX")
else()
if("${match}" STREQUAL "${replace}")
return() # Avoid reading the file or triggering warnings
endif()
set(arg_REGEX "")
endif ()
file(READ "${filename}" contents)
string(SHA512 before_hash "${contents}")
string(${arg_REGEX} REPLACE "${match}" "${replace}" contents "${contents}")
string(SHA512 after_hash "${contents}")
if(NOT arg_IGNORE_UNCHANGED AND "${before_hash}" STREQUAL "${after_hash}")
message("${Z_KMPKG_BACKCOMPAT_MESSAGE_LEVEL}" "kmpkg_replace_string made no changes.")
endif()
file(WRITE "${filename}" "${contents}")
endfunction()
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/kumo-pub/kmpkg.git
git@gitee.com:kumo-pub/kmpkg.git
kumo-pub
kmpkg
kmpkg
master

搜索帮助