Hi,
I want to process manifest.json file, exactly I want to remove javascripts comments from a file using CMake.
---[ manifest.json ]---
//This is a cmake generated file from a template located @ */plugins/firebreath/projects/dummy/Win/Helpers/Templates
// Chrome manifest template
//
{
"name": "Dummy Plugin",
"version": "1.0.0.1",
"minimum_chrome_version": "6.0",
"plugins":
[
{ "path": "Plugins/npdummy.dll", "public": true },
]
}
---[ manifest.json ]---
In my projectDef.cmake looks like:
---[ projectDef.cmake ]---
# ...
configure_file( # Needed on Build_CRX process.
Win/Helpers/Templates/manifest.json
${CMAKE_CURRENT_SOURCE_DIR}/Win/Helpers/Build_CRX
)
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/Win/Helpers/Build_CRX/manifest.json file_content)
message("Input:\n${file_content}")
set (file_content_res)
string(REGEX REPLACE "(^(//)[^\n]*)" "" file_content_res "${file_content}")
string(REGEX REPLACE "(^[\n])" "" file_content_res "${file_content_res}")
message("Output:\n${file_content_res}")
# file(WRITE "${CMAKE_CURRENT_SOURCE_DIR}/Win/Helpers/Build_CRX/manifest.json" "${file_content}")
# ...
---[ projectDef.cmake ]---
But this CMake code only removes first line and doesn't remove all lines that start with "//". What's wrong? I expect that "${file_content_res}" has all manifest file without all comment lines :-?
Thanks in advance.
Best regards