On Mon, Jan 18, 2010 at 7:17 PM, Mateusz Loskot <mate...@loskot.net> wrote: > Hi, > > In CMakeLists.txt I have something like this: > > if(MSVC) > set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4") > endif() > > I configure my build using command prompt of Visual Studio 2005 (8.0): > > D:\dev\geos\_svn\build-nmake>cmake -G "NMake Makefiles" ..\trunk > > and the compiler flags look as follows: > > CMAKE_CXX_FLAGS= /DWIN32 /D_WINDOWS /W3 /Zm1000 /EHsc /GR /W4 /MP > > I build and I'm getting D9025 warning: > > D:\dev\geos\_svn\build-nmake> nmake > > Microsoft (R) Program Maintenance Utility Version 8.00.50727.762 > Copyright (C) Microsoft Corporation. All rights reserved. > > [ 0%] Building CXX object src/CMakeFiles/geos.dir/algorithm/Angle.cpp.obj > cl : Command line warning D9025 : overriding '/W3' with '/W4' > > > Would it be possible to get rid of this warning with some CMake magic?
Yes, you can use a regular expression to search and replace the contents of CMAKE_CXX_FLAGS "/W3" (or /W[0-9]) with /W4... see string(REGEX REPLACE...) in the docs. Alternatively (and slightly better), you can create separate files that will set the default MSVC compilation flags for you. You'd do something like in the example below, but instead of CMAKE_CXX_FLAGS_DEBUG, CMAKE_CXX_FLAGS_RELEASE, etc., you would only need to specify CMAKE_C_FLAGS and CMAKE_CXX_FLAGS and make them whatever they are in the CACHE by default but with /W4 instead of /W3. http://www.itk.org/Wiki/CMake_FAQ#Make_Override_Files -- Philip Lowman _______________________________________________ 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