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.
I'm having a terrible time making this happen. The only mention of Zi in my pro files looks like this:
# Get rid of debug information
QMAKE_CFLAGS_DEBUG -= -Zi
QMAKE_CXXFLAGS_DEBUG -= -Zi
QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO -= -Zi
But when I load the Solution file, Property Pages
-> C/C++
-> All Options
-> Debug Information Format
, the Program Database (/Zi)
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).
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 -Zi
should prevent it from showing up.
If I set a project to <inherit from parent or project defaults>
manually, the Zi
option shows up again. Which leads me to believe it's being inherited... but from where?!
I'm losing my mind. Please help.
EDIT 1:
Apparently, the inherited properties comes from the Microsoft.Cpp.* property sheets. 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 -Zi
flag.
It sure would be nice to have a flag that forces None
for the Debug Information Format
. Anyone know what that might be?
EDIT 2:
Third idea: try to change the default location of the inherited property sheets to somewhere I can control.
The Windows environment variable $(UserRootDir) specifies the location of the inherited property sheets. MSBUILD allegedly allows you to change the value of this variable with the /property
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?
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 <DebugInformationFormat>
inside the vcxproj file and be done.
I submitted QTBUG-32885 for that 2 months ago, but it hasn't been fixed yet.
For now you can patch your qmake as described in the ticket.