Boost logo

Boost Interest :

Subject: Re: [Boost-cmake] [CMake] Visual Studio Warning Level
From: Michael Jackson (mike.jackson_at_[hidden])
Date: 2008-11-22 08:57:17

On Nov 22, 2008, at 8:01 AM, Vladimir Prus wrote:

> Bill Hoffman wrote:
>> Robert Dailey wrote:
>>> Hi,
>>> I've done some googling on how to set warning levels for visual
>>> studio
>>> projects generated with CMake and I can't say I really enjoy the
>>> proposed solutions I've found. Literally this should be a single
>>> function call like:
>>> cmake_warning_level( 4 )
>>> I expected something simple like above, but instead I found
>>> solutions
>>> that involved over 10 lines of code and very complex logic. This is
>>> really starting to discourage me from using CMake. I won't jump
>>> the gun,
>>> though, and I'll assume that I just haven't found that magically
>>> simple
>>> solution yet. Help is greatly appreciated!
>> CMake does not yet have a feature to flag type of mapping layer like
>> that. It is on the road map for the future. It could be and is done
>> with macros or functions in projects currently. I am pretty sure the
>> boost CMake files have macros that do this. Anyone have a macro for
>> this to post?
> Boost.Build allows you to write:
> bjam warnings=all
> and this will lead to /W4 on msvc (and to suitable options on other
> compilers)
> I don't think boost's CMake setup has this specific option, and
> generally,
> lacks most of advanced Boost.Build mechanisms necessary to portably
> specify build properties.
> - Volodya

    Could you please enumerate the advanced options that are missing
from boost's cmake setup so that I can start working on implementing
those options. (Cross Posting to Boost-CMake as that may become the
more appropriate place for this )

What are the equivalents in gcc to /w4, /w3, /w2, /w1? What are the
equivalents on icc, or any other compiler? What does bjam do?

That list is pretty long...

It is easy enough to add some macros to the boost cmake files.

macro(set_warning_level warning_level)

if (MSVC)

elseif (GCC)


macro(set_warning_level warning_level)

Mike Jackson mike.jackson_at_[hidden]
BlueQuartz Software
Principal Software Engineer Dayton, Ohio

Boost-cmake list run by bdawes at, david.abrahams at, gregod at, cpdaniel at, john at