Removing default COMPILE_FLAGS

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Removing default COMPILE_FLAGS

Daniel Nelson-3
I am building a project that has a single managed c++ target, and I need to
remove a compile flag for only this one target, since it conflicts with the -clr
flag.  Is it possible to remove a flag from the default CMAKE_CXX_FLAGS variable
only for this target?  Or do I have to remove the flag from the default flags
and add it in for every target except this one?

_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|

Re: Removing default COMPILE_FLAGS

Tyler Roscoe
On Tue, Dec 01, 2009 at 10:10:05PM +0000, Daniel Nelson wrote:
> flag.  Is it possible to remove a flag from the default CMAKE_CXX_FLAGS variable
> only for this target?  Or do I have to remove the flag from the default flags

I believe CMAKE_CXX_FLAGS is consulted each time an add_library() or
add_executable() call is processed. So you should be able to remove the
flag, add the singleton library/executable, and put the flag back.

tyler
_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|

Re: Removing default COMPILE_FLAGS

Daniel Nelson-3
> I believe CMAKE_CXX_FLAGS is consulted each time an add_library() or
> add_executable() call is processed. So you should be able to remove the
> flag, add the singleton library/executable, and put the flag back.
>
> tyler

This is the first thing I tried, however it doesn't seem to work.  
I seems they are written to the flags.make files at the end,
with whatever the final value of CMAKE_CXX_FLAGS is.
--
Daniel  





_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|

Re: Removing default COMPILE_FLAGS

Daniel Nelson-3
> > I believe CMAKE_CXX_FLAGS is consulted each time an add_library() or
> > add_executable() call is processed. So you should be able to remove the
> > flag, add the singleton library/executable, and put the flag back.
> >
> > tyler
>
> This is the first thing I tried, however it doesn't seem to work.  
> I seems they are written to the flags.make files at the end,
> with whatever the final value of CMAKE_CXX_FLAGS is.
> --
> Daniel  

Actually, I think it uses whatever the final value of CMAKE_CXX_FLAGS is within
the CMakeLists.txt file.  Since I was setting the variable back to its original
value in the same file with the target, the change was being undone, even
though I was setting it back after adding the target.  If I just leave the
value changed and let the normal scoping rules undo the change, it works
perfectly.

Now that I think about it, this seems like the same way that
include_directories() works.
--
Daniel

_______________________________________________
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