This removes the -DNDEBUG flag from the RelWithDebInfo configuration
while keeping the optimization flags -g -O2.
This configuration can be used by calling cmake with
-DCMAKE_BUILD_TYPE=RelWithDebInfo.
Differential D2639
[CMAKE] Override the flags for the RelWithDebInfo build configuration Fabien on Mar 4 2019, 12:54. Authored by
Details
This removes the -DNDEBUG flag from the RelWithDebInfo configuration This configuration can be used by calling cmake with mkdir buildcmake && cd buildcmake cmake -GNinja .. -DCMAKE_BUILD_TYPE=RelWithDebInfo ninja -v Check that the -g -O2 flags are set in the compile commands for both
Diff Detail
Event TimelineComment Actions As far as I can tell, building with RelWithDebInfo as build type already use the proper flags for optimization and debug. So at least a good chunk of this patch is just redoing what cmake already does, probably adding bugs in the process. It does looks like this patch is trying to do it all at once, which is pretty much always a bad idea. In that case, this translate in a patch of large complexity that does things that do not seems useful, and doesn't do things that seems useful (like setting corresponding flags for C). I would recommend to get to each build type on its own and make sure it works well, then move on to a second one, making sure to factor the utilities that are in common used to get there. Changing the default build for RelWithDebInfo can also be done on its own.
Comment Actions Ok I will split. Comment Actions If I pass -DCMAKE_BUILD_TYPE=RelWithDebInfo to cmake, I already get these flags. As far as I can tell, this code does nothing more than what cmake already does.
Comment Actions @deadalnix This is exact, the optimization flags are the same than the default with RelDebWithInfo. The point of overriding them with the same value is to remove the -DNDEBUG which is also part of the default flags.
|