🔧 Use cmake 3.19 string(JSON) for getting the latest version
This commit is contained in:
parent
4f4372aafd
commit
53c052ada4
2
.gitignore
vendored
2
.gitignore
vendored
@ -2,3 +2,5 @@ build
|
|||||||
tmp
|
tmp
|
||||||
|
|
||||||
.vscode/
|
.vscode/
|
||||||
|
|
||||||
|
.idea/
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
message("TOOL \"${TOOL}\" REPO \"${REPO}\"")
|
message("TOOL \"${TOOL}\" REPO \"${REPO}\"")
|
||||||
|
|
||||||
file(DOWNLOAD "https://github-get-latest-version.anotherfoxguy.workers.dev/${REPO}" "tmp/${TOOL}-version")
|
SET(URL "https://api.github.com/repos/${REPO}/releases/latest")
|
||||||
file(READ "tmp/${TOOL}-version" VERSION_DIRTY)
|
|
||||||
|
|
||||||
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})
|
string(REPLACE "." "_" VERSION_UNDERSCORE ${VERSION})
|
||||||
|
|
||||||
message("Latest VERSION ${VERSION}")
|
message("Latest VERSION ${VERSION}")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user