Michael Jackson wrote: > > 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 >> > > Vladimar, > 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 )
It might be a little bit hard to summarize several years of development, and a pile of code ;-) The key components (relevant to the original question of setting compiler options more-or-less portably) are: 1. Mechanism to map from portable build features to compiler options -- e.g. setting certain flag when the compiler is gcc and target-os=windows and link=shared. 2. Mechanisms to refine features a specific target is built with depending on requested features (e.g. on msvc, disable all warnings) > What are the equivalents in gcc to /w4, /w3, /w2, /w1? Here's the relevant code: toolset.flags gcc.compile OPTIONS <warnings>off : -w ; toolset.flags gcc.compile OPTIONS <warnings>on : -Wall ; toolset.flags gcc.compile OPTIONS <warnings>all : -Wall -pedantic ; > What are the > equivalents on icc, or any other compiler? What does bjam do? You would have to consult definitions for other compilers. > It is easy enough to add some macros to the boost cmake files. > > macro(set_warning_level warning_level) > > if (MSVC) > > elseif (GCC) > > endif() > > macro(set_warning_level warning_level) Such a code would have to be modified for every new compiler. - Volodya _______________________________________________ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake