<div dir="ltr">I haven't gotten around to this yet because I have some annoying issue with my installation of git (CMake uses git), but I love the idea of whipping up a 10 line patch, and hope to get around to it soon!<div class="gmail_extra"><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span style="font-size:12.8px">Assuming you did it that way, the way you would trigger this in CMake is to to add the .</span><span class="" style="font-size:12.8px;background-color:rgb(255,255,255)">natvis</span><span style="font-size:12.8px"> file just like any other file, and then after you do:</span><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">set_source_file_properties(foo.<span class="">natvis</span> LANGUAGE <span class="">natvis</span>)</div></blockquote><div class="gmail_extra"><br></div><div class="gmail_extra">Ahh, this CMake thing is starting to make sense now.</div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><span style="font-size:12.8px">Sincerely,</span><br style="font-size:12.8px"><span style="font-size:12.8px">Alexander Riccio</span><br style="font-size:12.8px"><span style="font-size:12.8px">--</span><br style="font-size:12.8px"><span style="font-size:12.8px">"Change the world or go home."</span><div style="font-size:12.8px"><a href="http://about.me/ariccio" target="_blank">about.me/ariccio</a></div><div style="font-size:12.8px"><a href="http://about.me/ariccio" target="_blank"><br></a></div><div style="font-size:12.8px">If left to my own devices, I will build more.</div><div style="font-size:12.8px">⁂</div></div></div></div></div></div>
<br><div class="gmail_quote">On Tue, Jan 12, 2016 at 2:24 PM, Zachary Turner <span dir="ltr"><<a href="mailto:zturner@google.com" target="_blank">zturner@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">CMake cannot yet do this.  You will need to change the Visual Studio 2015 generator to support the nativs tag.  I'm not a CMake developer, but a 5 minutes look at the CMake source code suggests this might be very easy.  If you look at cmVisualStudio10TargetGenerator::WriteAllSources(), you'll see that it calls GetLanguage() on the source file, and depending on which language is set, it uses a different tool.  Either ClCompile, MASM, ResourceCompile, etc.  It sounds like all you need to do is add another language type, called Natvis, and put it behind a check on the version of the generator to make sure this language is only recognized when VS Version >= 2015.<div><br></div><div>If it were me, I would whip up a 10 line patch that did exactly this, post it on the CMake dev list, and see what kind of feedback I got.</div></div><br><div class="gmail_quote"><div><div class="h5"><div dir="ltr">On Sun, Jan 10, 2016 at 3:59 PM <Alexander G. Riccio> via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br></div></div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div><div class="h5"><div dir="ltr">So, I've investigated this a bit more, and I see that adding a debug visualizer to a (simple test) project adds the following text to the vcxproj file:<div><br></div><div><div>  <ItemGroup></div><div>    <Natvis Include="..\..\..\..\..\..\..\LLVM\llvm\utils\llvm.natvis" /></div><div>  </ItemGroup></div></div><div><br></div><div>(This was an unrelated test project, hence the many path components)</div><div><br></div><div>...right after the main.cpp file:</div><div><br></div><div><div>  <ItemGroup></div><div>    <ClCompile Include="main.cpp" /></div><div>  </ItemGroup></div></div><div><br></div><div>...so that the vcxproj file looks like this:</div><div><br></div><div><div>  <ItemGroup></div><div>    <ClCompile Include="main.cpp" /></div><div>  </ItemGroup></div><div>  <ItemGroup></div><div>    <Natvis Include="..\..\..\..\..\..\..\LLVM\llvm\utils\llvm.natvis" /></div><div>  </ItemGroup></div><div><br></div></div><div>My question, then, is how can I get CMake to emit the "<Natvis Include=" element when generating the vcxproj files? Any CMake experts?</div><div><br></div><div>If CMake CANNOT yet do this, I'll just <a href="http://cmake.org/Bug" target="_blank">file a bug for it</a>.</div><div><br></div></div><div class="gmail_extra"></div><div class="gmail_extra"><br clear="all"><div><div><div dir="ltr"><div><div dir="ltr"><span style="font-size:12.8px">Sincerely,</span><br style="font-size:12.8px"><span style="font-size:12.8px">Alexander Riccio</span><br style="font-size:12.8px"><span style="font-size:12.8px">--</span><br style="font-size:12.8px"><span style="font-size:12.8px">"Change the world or go home."</span><div style="font-size:12.8px"><a href="http://about.me/ariccio" target="_blank">about.me/ariccio</a></div><div style="font-size:12.8px"><a href="http://about.me/ariccio" target="_blank"><br></a></div><div style="font-size:12.8px">If left to my own devices, I will build more.</div><div style="font-size:12.8px">⁂</div></div></div></div></div></div>
<br></div><div class="gmail_extra"><div class="gmail_quote">On Mon, Jan 4, 2016 at 8:01 PM, <Alexander G. Riccio> <span dir="ltr"><<a href="mailto:alexander@riccio.com" target="_blank">alexander@riccio.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">As of Visual Studio 2015, natvis files <a href="http://blogs.msdn.com/b/vcblog/archive/2015/09/28/debug-visualizers-in-visual-c-2015.aspx" target="_blank">can be included as part of individual projects</a>, a much better method than manually copying the file to an specific directory in %USERPROFILE%.<div><br></div><div>I think it should be included in one of the CMakeLists.txt files, does anybody know how I can add it?<br clear="all"><div><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><br></div><div dir="ltr">Sincerely,<br>Alexander Riccio<br>--<br>"Change the world or go home."<div><a href="http://about.me/ariccio" target="_blank">about.me/ariccio</a></div><div><a href="http://about.me/ariccio" target="_blank"><br></a></div><div>If left to my own devices, I will build more.</div><div>⁂<br></div></div></div></div></div></div></div>
</div></div>
</blockquote></div><br></div></div></div>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div>
</blockquote></div><br></div></div>