[CMake] Disabling warnings in Visual Studio Express 2008

Werner Smekal smekal at iap.tuwien.ac.at
Mon Oct 6 02:28:25 EDT 2008


Hi,

normally I just do

add_definitions( /wd4996 )

http://www.cmake.org/cmake/help/ 
cmake2.6docs.html#command:add_definitions

Despite its name you can also add compiler flags. Compile your program  
with

nmake VERBOSE=1

so that you can see if the compiler flags was successfully added.

Regards,
Werner

On 03.10.2008, at 20:50, user790 user790 wrote:

> Disabling specific warnings is a simple task so I thought I could do  
> it myself but I must admit defeat. A simple CMakeLists.txt like this  
> won't work.
> <code>
>
> project(testcmake)
> # None of this works
> #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4669")
> set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4669" CACHE STRING  
> "Compilation flags" FORCE)
> #set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /wd4669")
> set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /wd4669" CACHE  
> STRING "Compilation flags" FORCE)#set(CMAKE_CXX_FLAGS_RELEASE "$ 
> {CMAKE_CXX_FLAGS_RELEASE} /wd4669")
> set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /wd4669"  
> CACHE STRING "Compilation flags" FORCE)
> add_executable(foo foo.cxx)
> #doesn't work either
> set_target_properties(foo PROPERTIES COMPILE_FLAGS "/wd4996")
> </code>
>
> I only have VS Express 2008 so I can't check whether I am doing  
> something wrong or if there is some issue with this particular IDE  
> -- not even sure if it is explicitely not supported.
>
> Thanks for your help,
>
> Tom
>
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake

--
Dr. Werner Smekal
Institut fuer Allgemeine Physik
Technische Universitaet Wien
Wiedner Hauptstr 8-10
A-1040 Wien
Austria

email: smekal at iap.tuwien.ac.at
web: http://www.iap.tuwien.ac.at/~smekal
phone: +43-(0)1-58801-13463 (office), +43-(0)1-58801-13469 (laboratory)
fax: +43-(0)1-58801-13499



More information about the CMake mailing list