Skip to content

Instantly share code, notes, and snippets.

@rasjani
Created April 15, 2021 09:24
Show Gist options
  • Save rasjani/eabef10ef86fd311ec39fb279c364482 to your computer and use it in GitHub Desktop.
Save rasjani/eabef10ef86fd311ec39fb279c364482 to your computer and use it in GitHub Desktop.
function(get_version JSONFILE OUTVAR)
file(READ ${JSONFILE} _data)
string(REGEX MATCH "\"version\": \"(.*)\"," _version ${_data})
string(REPLACE "\"" ";" _data ${CMAKE_MATCH_1})
list(GET _data 0 _version)
set(${OUTVAR} "${_version}" PARENT_SCOPE)
endfunction()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment