[CMake] Visual Studio 8 and warning levels
Neal Meyer
nmeyer at dottedzebra.com
Thu Sep 27 20:04:30 EDT 2007
I'm having some trouble getting a clean way to set the warning level
in my projects with Visual Studio 2005.
When I try this
SET(CMAKE_C_WARNING_LEVEL 4)
SET(CMAKE_CXX_WARNING_LEVEL 4)
It seems to be ignored because the project files still have the
warning level set to 3. I only want to turn up (or down) the warning
level for particular projects so I don't want to mess with the cache
variable.
I found this searching through old posts and it works, but it seems a
bit sloppy to have to do this when there is a simply way to just set
the Warning Level.
IF(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
STRING(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
ELSE(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
ENDIF(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
-Neal
More information about the CMake
mailing list