[Exherbo-dev] Set CMake build type as build_option

Niels Ole Salscheider niels_ole at salscheider-online.de
Sat Apr 16 10:39:00 UTC 2016


Hello,

currently, we set the CMAKE_BUILD_TYPE to "None". The reason for this is that 
CMake has CMAKE_C{,XX}_FLAGS variables where the corresponding build flags can 
be passed. When the build type is "None", only these flags are used. If the 
build type is however set to anything else, then the flags from CMAKE_C{,XX}
_FLAGS_$TYPE will be appended to the former.

This seems to make sense because the additional variables contain flags that we 
don't want. CMAKE_CXX_FLAGS_RELEASE, for example, defaults to "-O3 -DNDEBUG" 
and we don't want the -O3 flag.
But the "None" type is not really supported and some projects (e. g. LLVM) 
even forbid it. Apart from that projects might add additional flags to these 
variables. They could for example add defines that enable some debug code only 
in debug builds.

It would therefore make sense to set the build type to the right value so that 
these flags can be included. In that case we would also have to set the default 
values of all CMAKE_C{,XX}_FLAGS_$TYPE variables to sensible values that do 
not include any -O flags. CMAKE_CXX_FLAGS_RELEASE would for example only 
contain "-DNDEBUG".

Bernd Steinhauser proposed that we should set the CMake build type based on a 
build_option. What do you think?

Ole
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.exherbo.org/pipermail/exherbo-dev/attachments/20160416/96a3d3e5/attachment.asc>


More information about the Exherbo-dev mailing list