Michael Jackson wrote:

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)


When this is done in CMake, that information will go into the Modules/Platform files. So, it might be best to come up with something that uses the same idea as that.

INCLUDE(MyPlatform/${CMAKE_SYSTEM_NAME}-${CMAKE_CXX_COMPILER_ID}-CXX OPTIONAL )

Put MyPlatform into the CMAKE_MODULE_PATH, then create platform files in MyPlatform/Linux-Intel-C.cmake

set(${CMAKE_CXX_COMPILER_ID}-CXX-WARNING1 -W1)

Then have the macro just add the specified warning variable. If someone works out all the names, we can then move this stuff into CMake CVS.

-Bill
_______________________________________________
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to