I manage all the warning levels by hand. If you are truly in a rush this is what I do:
# The idea is to match a string that ends with cl but doesn't have icl in it. set(COMPILER_NAME_REGEXPR "([^i]|^)cl.*$") if(CMAKE_C_COMPILER MATCHES ${COMPILER_NAME_REGEXPR} AND CMAKE_CXX_COMPILER MATCHES ${COMPILER_NAME_REGEXPR}) set(USING_WINDOWS_CL TRUE) # We should set this macro as well to get our nice trig functions add_definitions(-D_USE_MATH_DEFINES) # Microsoft does some stupid things like #define min and max. add_definitions(-DNOMINMAX) endif() # This code is kind of off the seat of my pants, but I do something similar. if(USING_WINDOWS_CL) set(flag "/W4") # Only add the flag in once if(NOT CMAKE_CXX_FLAGS MATCHES "${flag}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}" CACHE LIST "Compile flags" FORCE) endif() endif() James _______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake