Mark de Wever | 8 Jul 2012 09:34
Picon
Picon
Favicon

Changing the CMake compiler flags

Hi,

A small heads up for a CMake change I'll be committing in a short while,
the patch is attached.

I've been fiddling with the way CMake defines the compiler flags and
have a patch to change their implementation.

At the moment the flags are determined on the first run and stored in
CMAKE_CXX_FLAGS, CMAKE_CXX_FLAGS_DEBUG and CMAKE_CXX_FLAGS_RELEASE[*].
This was actuall not a good idea, since CMake combines CMAKE_CXX_FLAGS
with the CMAKE_CXX_FLAGS_≤BUILD_TYPE>. The problem with this setup is
when the compiler is changed the flags are reset to their defaults and
the user made changes to the flags are lost. The second issue with the
old implementation is that the ENABLE_STRICT_COMPILATION CMake option
must be directly set; changing its value after the initial generation
had no effect. 

The change will only set CMAKE_CXX_FLAGS, based on the environment
variable $CXXFLAGS, this is stored in its own variable, named
CXX_FLAGS_USER, in CMake and can be changed later. This flag is only
initialised on the first run. It is also based on the default flags we
use for Wesnoth and the _current_ state of the ENABLE_STRICT_COMPILATION
option. For the transition from the old to the new system the old
CMAKE_CXX_FLAGS are used as initial value for the CXX_FLAGS_USER. This
means no flags are lost, but some extra flags are added, will CMake to
cause a recompilation. So it's advised to regenerate the project files
or change the CXX_FLAGS_USER after CMake as updated the flags.

Since several people seem to be interested in the extra compiler flags I
(Continue reading)

Mark de Wever | 10 Jul 2012 21:08
Picon
Picon
Favicon

Re: Changing the CMake compiler flags

On Sun, Jul 08, 2012 at 09:34:13AM +0200, Mark de Wever wrote:
> Hi,
> 
> A small heads up for a CMake change I'll be committing in a short while,
> the patch is attached.

The patch has been committed as r54685.

--

-- 
Regards,
Mark de Wever aka Mordante/SkeletonCrew

Gmane