[Dune] cmake docu ?

Carsten Gräser graeser at mi.fu-berlin.de
Wed Nov 26 20:47:43 CET 2014


Hi Christoph,

Am 26.11.2014 um 17:11 schrieb Christoph GrĂ¼ninger:
> Hi Carsten,
> I have missed to answer your email.
> 
> make does not support multiple build types like DEBUG and RELEASE.
> Quoting the documentation of CMAKE_BUILD_TYPE:
yes I know but...

>> This variable is only meaningful to single-configuration generators
>> (such as make and Ninja) i.e. those which choose a single
>> configuration when CMake runs to generate a build tree as opposed to
>> multi-configuration generators which offer selection of the build
>> configuration within the generated build environment.
Doesn't this text just explaining that CMAKE_BUILD_TYPE
is meaningful for the make generator and that it's purpose
is exactly to kick in for generators like make, that do _not_
provide a mechanism for switching build types themselves?

As far as I understand the idea is that you tell cmake
the built type and that hard wires the flags for this
(single) build type in the make files. If you want to
change the build type you can't ask make but have to
do this using the cmake facilities. 

> So I guess multiple opts file are the solution. Or you can write CC=..
> and CXX=.. in front of your dunecontrol call. That's the way I usually
> set the complier, after I delete the complete build directory.
For me using the cmake facilities to select build types seems to be
the cleaner solution. However I just forgot that the option
are evaluated using the shell so doing

  BUILDTYPE=Release dunecontrol --opts=dune.opts all

with an option file of the form

  BUILDDIR="build-$BUILDTYPE"
  CMAKE_FLAGS="\
    -DCMAKE_BUILD_TYPE=$BUILDTYPE \
    -DCMAKE_CXX_FLAGS='-g -O2' \
    -DCMAKE_CXX_FLAGS_DEBUG='-g -O0 -Wall -pedantic' \
    -DCMAKE_CXX_FLAGS_RELEASE='-O3 -DNDEBUG -funroll-loops -march=native'"

does the trick. Being able to pass the build type as an option
would just be syntactic candy. The main question for me is, if
we should teach people to use the approach cited above or different
option files for each build type.

Best,
Carsten

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: OpenPGP digital signature
URL: <https://lists.dune-project.org/pipermail/dune/attachments/20141126/0f5eaf8e/attachment.sig>


More information about the Dune mailing list