🔧 Use cmake 3.19 string(JSON) for getting the latest version
This commit is contained in:
@ -1,9 +1,11 @@
|
||||
message("TOOL \"${TOOL}\" REPO \"${REPO}\"")
|
||||
|
||||
file(DOWNLOAD "https://github-get-latest-version.anotherfoxguy.workers.dev/${REPO}" "tmp/${TOOL}-version")
|
||||
file(READ "tmp/${TOOL}-version" VERSION_DIRTY)
|
||||
SET(URL "https://api.github.com/repos/${REPO}/releases/latest")
|
||||
|
||||
string(REGEX REPLACE /[^0-9\\.]/ "" VERSION ${VERSION_DIRTY})
|
||||
execute_process(COMMAND curl -s -L ${URL} OUTPUT_VARIABLE VERSION_JSON)
|
||||
string(JSON VERSION_DIRTY GET ${VERSION_JSON} tag_name)
|
||||
|
||||
string(REGEX REPLACE [^0-9\\.] "" VERSION "${VERSION_DIRTY}")
|
||||
string(REPLACE "." "_" VERSION_UNDERSCORE ${VERSION})
|
||||
|
||||
message("Latest VERSION ${VERSION}")
|
||||
|
Reference in New Issue
Block a user