<div dir="ltr">I ran into this today. I tried to use /MD to link against a custom md library, but because _DEBUG was defined *by CMake* I couldn't use it out of the box.<div><br></div><div>Why is CMake defining _DEBUG for MSVC projects anyways? _DEBUG is automatically defined when using /MDd, and I don't believe it should be defining it itself. I've had to remove it for multiple projects because it's making assumptions as to what I want defined.</div><div><br></div><div><br></div><div>Default for CMAKE_CXX_FLAGS_DEBUG_INIT<br></div><div><font face="monospace, monospace">/D_DEBUG /MDd /Zi /Ob0 /Od /RTC1</font><br></div><div><font face="monospace, monospace"><br></font></div><div><font face="arial, helvetica, sans-serif">I don't think that first define should be there. </font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">Reference: </font></div><a href="https://github.com/Kitware/CMake/blob/5d29506811c5b75ae48e12de6c317f6440874215/Modules/Platform/Windows-MSVC.cmake#L294">https://github.com/Kitware/CMake/blob/5d29506811c5b75ae48e12de6c317f6440874215/Modules/Platform/Windows-MSVC.cmake#L294</a><div><a href="https://msdn.microsoft.com/en-us/library/0b98s6w8.aspx">https://msdn.microsoft.com/en-us/library/0b98s6w8.aspx</a><font face="arial, helvetica, sans-serif"><br></font></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Nov 11, 2016 at 9:42 AM, Stephan Menzel <span dir="ltr"><<a href="mailto:stephan.menzel@gmail.com" target="_blank">stephan.menzel@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><span class=""><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Nov 8, 2016 at 4:21 PM,  <span dir="ltr"><<a href="mailto:clinton@elemtech.com" target="_blank">clinton@elemtech.com</a>></span> wrote:<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="font-family:arial,helvetica,sans-serif;font-size:12pt;color:#000000"><div><div>If you are going to use /MD instead of /MDd, then you probably also need to remove the _DEBUG preprocessor flag.</div><div>IIRC, I've seen cases where defining _DEBUG includes symbols only defined by the debug runtimes.</div><div><br></div><div>Clint</div></div></div></div></blockquote></div><br></div></span><div class="gmail_extra">What a surprise. Removing _DEBUG did the trick. I was under the impression _DEBUG only controls Microsoft STL impl's debug iterator stuff but apparently it also makes the resulting exe link with /MD rather than /MDd. Guess that was wrong.</div><div class="gmail_extra"><br></div><div class="gmail_extra">So yes, problem solved.</div><div class="gmail_extra"><br></div><div class="gmail_extra">Thank you!</div><span class="HOEnZb"><font color="#888888"><div class="gmail_extra"><br></div><div class="gmail_extra">Stephan</div></font></span></div>
<br>--<br>
<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" rel="noreferrer" target="_blank">http://www.cmake.org/Wiki/<wbr>CMake_FAQ</a><br>
<br>
Kitware offers various services to support the CMake community. For more information on each offering, please visit:<br>
<br>
CMake Support: <a href="http://cmake.org/cmake/help/support.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/<wbr>support.html</a><br>
CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/<wbr>consulting.html</a><br>
CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/<wbr>training.html</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/<wbr>opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/cmake" rel="noreferrer" target="_blank">http://public.kitware.com/<wbr>mailman/listinfo/cmake</a><br></blockquote></div><br></div>