🔧 Use cmake 3.19 string(JSON) for getting the latest version

This commit is contained in:
Edgar 2020-11-19 11:05:28 +01:00
parent 4f4372aafd
commit 53c052ada4
No known key found for this signature in database
GPG Key ID: 17D930BB616061A5
2 changed files with 7 additions and 3 deletions

2
.gitignore vendored
View File

@ -2,3 +2,5 @@ build
tmp tmp
.vscode/ .vscode/
.idea/

View File

@ -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}")