[CMake] Visual Studio Warning Level

Vladimir Prus vladimir at codesourcery.com
Sat Nov 22 08:01:15 EST 2008

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

More information about the CMake mailing list