I did forget the list ---------- Forwarded message ---------- From: Eric Noulard <[EMAIL PROTECTED]> Date: 4 janv. 2008 18:33 Subject: Re: [CMake] Globally add compiler options for gcc To: Stephen Collyer <[EMAIL PROTECTED]>
2008/1/4, Stephen Collyer <[EMAIL PROTECTED]>: > This is almost certainly a FAQ but I can't find > an answer anywhere: I'm building using gcc under > Linux and VS2005 under Win32. I want to add, say, > -Wall globally to everything compiled under Linux > but leave the compile options for Win32 untouched. You may put in your main CMakeLists.txt IF(UNIX) IF(CMAKE_COMPILER_IS_GNUCC) ADD_DEFINITION(-Wall) ENDIF(CMAKE_COMPILER_IS_GNUCC) ENDIF(UNIX) This example checks for being under UNIX and GCC is the compiler. If you want to restrict to Linux you should add a test for CMAKE_SYSTEM_NAME value to match "Linux". In this particular case and if you only compile C code you may replace ADD_DEFINITIONS with: SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall") If you want more stringent checks you add "-Werror -pedantic -ansi" to your "-Wall" :=) > > How do I do that ? > > -- > Regards > > Steve Collyer > Netspinner Ltd > _______________________________________________ > CMake mailing list > CMake@cmake.org > http://www.cmake.org/mailman/listinfo/cmake > -- Erk -- Erk _______________________________________________ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake