[CMake] Visual Studio Warning Level

Michael Jackson mike.jackson at bluequartz.net
Sat Nov 22 15:15:53 EST 2008


On Nov 22, 2008, at 1:13 PM, Robert Dailey wrote:

> So it seems that this issue has come up before and it is an obvious  
> feature to implement. In the meantime, can someone offer me the code  
> for a macro I can use to easily and portably set warning levels?
>
> Thanks


pseudo code

macro(set_warning_level level)

if (MSVC)
# Set msvc type warnings
SET (CXX_FLAGS ${CXX_FLAGS} [your warnings here])

elseif(GCC)
# set gcc type warnings
SET (CXX_FLAGS ${CXX_FLAGS} [your warnings here])

else()
# we don't know this compiler
message(STATUS "Warning levels have not been defined for this compiler")

endif()

endmacro(set_warning_level level)


_________________________________________________________
Mike Jackson                  mike.jackson at bluequartz.net
BlueQuartz Software                    www.bluequartz.net
Principal Software Engineer                  Dayton, Ohio





More information about the CMake mailing list