forked from qt-creator/qt-creator
CMake: Fix semicolon handling
Change-Id: I63fb5eeb644b955e54ba9047a056169e47bb12f9 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -334,11 +334,18 @@ endfunction(add_qtc_library)
|
|||||||
|
|
||||||
function(markdown_to_json resultVarName filepath)
|
function(markdown_to_json resultVarName filepath)
|
||||||
file(STRINGS ${filepath} markdown)
|
file(STRINGS ${filepath} markdown)
|
||||||
list(TRANSFORM markdown REPLACE "\\\\" "\\\\\\\\") # Replace \ with \\
|
set(result "")
|
||||||
list(TRANSFORM markdown REPLACE "\\\"" "\\\\\"") # Replace " with \"
|
foreach(line IN LISTS markdown)
|
||||||
list(TRANSFORM markdown PREPEND " \"" )
|
string(REPLACE "\\" "\\\\" line "${line}") # Replace \ with \\
|
||||||
list(TRANSFORM markdown APPEND "\"")
|
string(REPLACE "\"" "\\\"" line "${line}") # Replace " with \"
|
||||||
list(JOIN markdown ",\n" result)
|
string(PREPEND line " \"")
|
||||||
|
string(APPEND line "\"")
|
||||||
|
# We have to escape ; because list(APPEND ...) will split the string at ;
|
||||||
|
# list(JOIN ...) will replace the \; with ; again
|
||||||
|
string(REPLACE ";" "\\;" line "${line}")
|
||||||
|
list(APPEND result "${line}")
|
||||||
|
endforeach()
|
||||||
|
list(JOIN result ",\n" result)
|
||||||
set(result "[\n${result}\n ]")
|
set(result "[\n${result}\n ]")
|
||||||
set("${resultVarName}" ${result} PARENT_SCOPE)
|
set("${resultVarName}" ${result} PARENT_SCOPE)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
Reference in New Issue
Block a user