[ITK] ITKModuleMacros.cmake macro(itk_module_warnings_disable) MSVC warning D9025: overriding '/W1' with '/w'

Niels Dekker niels-xtk at xs4all.nl
Tue Feb 17 10:54:43 EST 2015


Floris Berendsen and I encountered many (5O+) 'D9025' warnings when we
built ITK on Visual Studio. The warning message text says:

  cl : Command line warning D9025: overriding '/W1' with '/w'

Do other Visual Studio users also get these warnings, when compiling ITK? 
We don't see them at the dashboard,
https://open.cdash.org/index.php?project=Insight

It appears that the warnings are triggered by the macro
'itk_module_warnings_disable', ironically. This macro from
"ITKModuleMacros.cmake" adds "-w" to the compiler flags. Visual Studio
automatically adds "/W1" as well, which causes the compiler warning. It
appears that the warning can be avoided by a very small modification in
itk_module_warnings_disable: use "/W0" instead of "-w", in
ITKModuleMacros.cmake:

     foreach(lang ${ARGN})
       if(MSVC)
         string(REGEX REPLACE "(^| )[/-]W[0-4]( |$)" " "
  -        CMAKE_${lang}_FLAGS "${CMAKE_${lang}_FLAGS} -w")
  +        CMAKE_${lang}_FLAGS "${CMAKE_${lang}_FLAGS} /W0")

"/W0" has the same meaning as "/w", see
https://msdn.microsoft.com/en-us/library/thxezb7y.aspx  But it appears
that when itk_module_warnings_disable adds "/W0", instead of "-w", we
don't get those 'D9025' warnings.

We saw this issue on both Visual Studio 2010 and Visual Studio 2013
(Update 4), and various versions of CMake, including the latest release,
CMake 3.1.3. We tried the ITK version from ITK.git.

Kind regards, Niels
-- 
Niels Dekker
Scientific programmer
LKEB, Division of Image Processing
Leiden University Medical Center



More information about the Community mailing list