[CMake] TRY_COMPILE and -Werror

Arnaud GELAS arnaud_gelas at hms.harvard.edu
Fri Aug 20 12:18:33 EDT 2010


  Hi all,

I would like to check if one piece of code generates a warning or not 
(about a deprecated method). I want to use TRY_COMPILE and adds -Werror 
to gcc flags.

I have tried the following:

TRY_COMPILE(VTK_FFMPEG_GUESSFORMAT
          ${VTK_BINARY_DIR}/CMakeTmp
          ${VTK_CMAKE_DIR}/vtkFFMPEGTestGuessFormat.cxx
          CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:STRING=${FFMPEG_INCLUDE_DIR}"
            -DCOMPILE_DEFINITIONS:STRING=-D${VTK_FFMPEG_CDEFS}
            -DCOMPILE_DEFINITIONS:STRING=-D__STDC_CONSTANT_MACROS
           "-DLINK_LIBRARIES:STRING=${FFMPEG_avformat_LIBRARY}"
           "-DCMAKE_CXX_FLAGS:STRING=-Werror"
          OUTPUT_VARIABLE OUTPUT)

But VTK_FFMPEG_GUESSFORMAT is still true...

Any idea?

Thanks,
Arnaud


More information about the CMake mailing list