title: Removing -Zi flag with qmake, for Visual Studio 2012
body: <p>I have a large Visual Studio 2012 Solution with about 15 Projects inside. I would really like to disable debugging symbol generation for a few of these Projects; the rest should allow debugging. All of this is related to the Debug configuration.</p>
  
  <p>I'm having a terrible time making this happen. The only mention of Zi in my pro files looks like this:</p>
  
  <pre><code># Get rid of debug information
  QMAKE_CFLAGS_DEBUG -= -Zi
  QMAKE_CXXFLAGS_DEBUG -= -Zi
  QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO -= -Zi
  </code></pre>
  
  <p>But when I load the Solution file, <code>Property Pages</code> -> <code>C/C++</code> -> <code>All Options</code> -> <code>Debug Information Format</code>, the <code>Program Database (/Zi)</code> option is still displayed. I also removed any mention of Zi in the mkspecs and qmake.conf (even though the above -= lines should have removed it).</p>
  
  <p>So I opened the qmake source code (every file under qmake/generators/win32), and I see that there doesn't seem to be a way to turn off debug symbols; only the absence of a <code>-Zi</code> should prevent it from showing up.</p>
  
  <p>If I set a project to <code>&lt;inherit from parent or project defaults&gt;</code> manually, the <code>Zi</code> option shows up again. Which leads me to believe it's being inherited... but from where?!</p>
  
  <p>I'm losing my mind. Please help.</p>
  
  <hr>
  
  <p><strong>EDIT 1:</strong></p>
  
  <p>Apparently, the inherited properties comes from <a href="http://blogs.msdn.com/b/vsproject/archive/2009/06/23/inherited-properties-and-property-sheets.aspx" rel="nofollow">the Microsoft.Cpp.* property sheets</a>. Follow the instructions in that link for finding the property sheets inherited by your project, and you can modify them to get rid of the <code>-Zi</code> flag.</p>
  
  <p>It sure would be nice to have a flag that forces <code>None</code> for the <code>Debug Information Format</code>. Anyone know what that might be?</p>
  
  <hr>
  
  <p><strong>EDIT 2:</strong></p>
  
  <p>Third idea: try to change the default location of the inherited property sheets to somewhere I can control.</p>
  
  <p>The Windows environment variable $(UserRootDir) specifies the location of the inherited property sheets. MSBUILD <a href="http://msdn.microsoft.com/en-us/library/vstudio/ms164311.aspx" rel="nofollow">allegedly</a> allows you to change the value of this variable with the <code>/property</code> command line argument. Unfortunately, I can't figure out how to get qmake to accept the argument. Is there any way to set input arguments to the qmake MAKEFILE_GENERATOR builder?</p>
  
  <p>This quest is starting to feel like a wild goose chase. If CMD had sed abilities, I'd just write a script to change the <code>&lt;DebugInformationFormat&gt;</code> inside the vcxproj file and be done.</p>