<div style="font-family: arial, helvetica, sans-serif; font-size: 10pt"><div dir="ltr">On Sun, Dec 9, 2012 at 3:32 PM, Laszlo Nagy <span dir="ltr"><<a href="mailto:rizsotto.mailinglist@gmail.com" target="_blank">rizsotto.mailinglist@gmail.com</a>></span> wrote:<br>
<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<div><br></div><div>I need some help to clarify the JSON compilation database syntax... This document <<a href="http://clang.llvm.org/docs/JSONCompilationDatabase.html" target="_blank">http://clang.llvm.org/docs/JSONCompilationDatabase.html</a>> gives an example with space separated definition. I tried to reproduce the desired output with cmake, but failed.</div>

<div><br></div><div>  add_definitions(-DQUOTED_DEF="With spaces and quotes.")</div><div>  add_definitions(-DESCAPED_DEF=With\ spaces\ and\ without\ quotes.)</div><div><br></div><div>These extra lines causes this command on the terminal</div>

<div><br></div><div>  gcc -DQUOTED_DEF="\"With spaces and quotes.\"" -DESCAPED_DEF="With spaces and without quotes."  -o ...</div><div><br></div><div>And the compile_commands.json file has entry like this</div>

<div><br></div><div>  "command": "/usr/lib64/ccache/gcc -DQUOTED_DEF=\"\\\"With spaces and quotes.\\\"\" -DESCAPED_DEF=\"With spaces and without quotes.\" -o ..."</div><div>

<br></div><div>(The cmake version is 2.8.9) My understanding is that cmake does produce valid JSON here. Only the document was wanted more elegant escaping by single quotes. (-DSOMEDEF='\"With spaces and quotes.\"') Is that correct?</div>
</blockquote><div><br></div><div style>Yes, the document is incorrect. Sorry for that, no idea what I smoked that day...</div><div style><br></div><div style>Thx for reporting,</div><div style>/Manuel</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div><br></div><div>Regards,</div><div>Laszlo</div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Nov 17, 2012 at 10:06 PM, Laszlo Nagy <span dir="ltr"><<a href="mailto:rizsotto.mailinglist@gmail.com" target="_blank">rizsotto.mailinglist@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<div><br></div><div>wrote a small program which might help to use the tools, which are using the tooling library. My understanding was that these tools need some compilation database. And one format is the JSON compilation database, which comes for free in a cmake project. Other projects could have difficulties to generate such file. And that's where a tool could help.</div>


<div><br></div><div>  <a href="https://github.com/rizsotto/Bear" target="_blank">https://github.com/rizsotto/Bear</a><br></div><div><br></div><div>It runs the build command and intercept the 'exec' calls, filters the compiler invocations and generate the output file. (It is using LD_PRELOAD from GNU Libc, so it is not really portable.)</div>


<div><br></div><div>I know these kind of tools are out of scope here. But wanted to mention, because it could simplify to solve some cases. At least it did to me. ;)</div><div><br></div><div>Regards,</div><div>Laszlo</div>


</blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><br></div></div></div></div>