mirror of
https://github.com/Kitware/CMake.git
synced 2026-02-06 15:19:56 -06:00
9 lines
378 B
CMake
9 lines
378 B
CMake
macro(read_json filename outvar)
|
|
file(READ ${filename} contents)
|
|
# string(JSON *) will fail if JSON file contains any forward-slash paths
|
|
string(REGEX REPLACE "[\\]([a-zA-Z0-9 ])" "/\\1" contents ${contents})
|
|
# string(JSON *) will fail if JSON file contains any escaped quotes \"
|
|
string(REPLACE "\\\"" "'" contents ${contents})
|
|
set(${outvar} ${contents})
|
|
endmacro()
|