[CMake] Visual Studio Warning Level

Bill Hoffman bill.hoffman at kitware.com
Mon Nov 24 08:42:27 EST 2008


Judicaël Bedouet wrote:

> 
> I love the idea to set warning flags in platform files but I don't
> understand why new files must be created. Is not it possible to add
> warning variables to existent platform files in Modules/Platform ?
> 
That would be the end goal.  However, if someone wanted it sooner it 
could be done inside a project by creating platform files that could be 
merged into CVS CMake.   My point was that it would be much easier to 
merge a platform file based solution than a if,else type solution.

> I wonder if it would be possible to add a CMAKE_WARNING_LEVEL variable
> (like CMAKE_BUILD_TYPE) which could take values like Warning1,
> Warning2, Warning3, Warning4 (or All, Full, No).
> So we could define in platform files CMAKE_CXX_FLAGS_WARNING1_INIT,
> CMAKE_CXX_FLAGS_WARNING2_INIT... variables (like
> CMAKE_CXX_FLAGS_DEBUG_INIT, CMAKE_CXX_FLAGS_RELEASE_INIT).
> The final default value for CMAKE_CXX_FLAGS would be
> "${CMAKE_CXX_FLAGS_INIT} ${CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}_INIT}
> ${CMAKE_CXX_FLAGS_${CMAKE_WARNING_LEVEL}_INIT}".
> 
> I think it would be a great idea that CMake provide default and
> portable warning flags.
I am thinking we could use global properties for this, instead of 
variables.  Also, no need to use _INIT type stuff as it would not have 
to be stored in the cache, and users would never need/want to change them.

> If you need any help, I would be very pleased to contribute.
> 
Sounds good.

-Bill


More information about the CMake mailing list