https://bugs.kde.org/show_bug.cgi?id=360249

--- Comment #3 from Jan Kundrát <j...@kde.org> ---
CMake's selection of build type is, unfortunately, only half-baked. In 
particular, in the range of cmake versions, build types and compilers we 
support, plenty of them do not ship with sufficient flags. I would love to 
not mess with the build flags, but that's unfortunately just not possible.

There are several toggles which are of interest, and which are currently 
being toggle by the rather high-level abstraction of a build type. One of 
them is a decision to enable or disable assertions (Q_ASSERT), the other 
decisions affect the availability of the debug symbols, yet others control 
code optimization levels.

I decided that I want to have a convenient way to let other contributors 
build in a way which is suitable for Trojita development. To me, 
CMAKE_BUILD_TYPE=Debug is a nice approximation of this. I need this mode to 
enable assetions and to provide debug symbols. At the same time, because 
this is a version of Trojita which I (and other contributors, presumably) 
end up running on a daily basis, it's desirable to let the compiler do its 
job and still produce an optimized build -- simply because that's what the 
most people are going to use, and to make sure that profiling still 
produces usable data.

At the same time, the code already supports users to override any buid 
parameters by passing appropriate CXXFLAGS. If you are bitten by, for 
example, a compiler optimizing away variables in the optimized debug build, 
you can ask it not to perform any optimizations through, for example, -O0 
or -Og.

This bugreport says that you expected no optimizations to be active when 
doing the debug build type. This won't happen for the reasons outlined 
above. I'm, unfortunately, still doing many rebuilds a day, and I find the 
associated drawbacks to be acceptable -- especially considering that I once 
spent several days optimizing an apparent hotspot which was completely 
elliminated through -O2 "in a real world", which is why the *default* of 
-O2 in debug builds was introduced. Just set your CXXFLAGS to whatever 
value you prefer if it bothers you.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to