CMake build types

Hi again,

Some time ago I introduced a custom CMake variable, RELEASE_MODE. That
was not the correct to proceed. So I changed that and we now use
CMake’s standard handling of build types – which I copied from KDE.

All is now based on the standard CMake variable CMAKE_BUILD_TYPE.

Here’s how it works in CMake: the C++ compile flags are the
concatenation of CMAKE_CXX_FLAGS and CMAKE_CXX_FLAGS_FOO where Foo is
the value of CMAKE_BUILD_TYPE. This is case-insensitive. So if you pass
-DCMAKE_BUILD_TYPE=Release
then CMake will use the flags from both CMAKE_CXX_FLAGS and
CMAKE_CXX_FLAGS_RELEASE.

The build types themselves are not a standard thing. As you can see in
CMakeLists, I defined three of them (copying that stuff from KDE):
Debug, RelWithDebInfo, Release.

By default, CMAKE_BUILD_TYPE is empty. I copied what KDE does: if it
is empty then set it to RelWithDebInfo. I believe that this is a good
balance and, contrary to Debug, does not risk making us look bad to
prospective users who could be surprised by the poor performance of a
Debug build if we set that the be the default. But, this is just a
suggestion, feel free to change that.

All that is in the top-level CMakeLists. The great thing about using
CMake’s built-in system is that this is expressed in very few lines.

Cheers,
Benoit

P.S. Today Carsten finally managed to build avogadro, by disabling the
python stuff. This means that he doesn’t have any excuse anymore :slight_smile:


This message was sent using IMP, the Internet Messaging Program.