On Mon, Mar 2, 2009 at 7:37 AM, Leopold Palomo Avellaneda <l...@alaxarxa.net>wrote:
> Hi, > > I have a problem with one project. There's one file that doesn't accept a > some > compiler flags because g++ then has problems (templates, etc). > > So, I would like to set with another valuer the CMAKE_CXX_FLAGS_RELEASE and > CMAKE_CXX_FLAGS_RELWITHDEBINFO for an _specific_ target. > > I have looked in the documentation and I have found how to add > (COMPILE_FLAGS) > but not how to delete/remove flags. Someone hows how to do it? I'm not sure if CMake has a good way to remove definitions added to CMAKE_CXX_FLAGS or CMAKE_CXX_FLAGS_<FOO>. I think generally you're supposed to avoid adding things to this unless you want it to be compiled on all targets. You can use add_definitions() and remove_definitions() for this kind of thing provided you don't need it for a particular release type. if(CMAKE_COMPILER_IS_GNUCC) add_definitions(-Wall) endif() add_subdirectory(foo) foo/CMakeLists.txt ========== if(CMAKE_COMPILER_IS_GNUCC) remove_definitions(-Wall) endif() If you do need this for a particular release type you could use STRING(REPLACE...) directly on CMAKE_CXX_FLAGS_RELEASE, for example. Toplevel: ===== set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -funroll-loops") add_subdirectory(foo) add_subdirectory(bar) foo/CMakeLists.txt ===== string(REPLACE "-funroll-loops" "" CMAKE_CXX_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE}) add_executable(bar foo.cc) Hope that helps -- 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