[CMake] How to set different compiler flags for two projects in one solution

Tyler Roscoe tyler at cryptio.net
Wed Sep 30 15:49:53 EDT 2009


On Wed, Sep 30, 2009 at 08:17:43PM +0200, Tanguy Krotoff wrote:
> On Wed, Sep 30, 2009 at 8:08 PM, Tyler Roscoe <tyler at cryptio.net> wrote:
> > So the first change, where you change from /MD to /MT, does work, but
> > the second change, where you change /MT back to /MD, does not work?
> 
> Exactly
> 
> > When I do this trick, I don't mess with the value in the cache; I just
> > change CMAKE_C_FLAGS. So maybe remove the CACHE parts and see if that
> > helps?
> 
> What do you mean by CACHE parts?
> Do you mean I should use CMAKE_C_FLAGS instead of CMAKE_C_FLAGS_DEBUG
> and friends?

See the word "CACHE" in your example code? Why is it there?

Given that your first change works but your second change doesn't, I
suspect that the fact that you're trying to set these variables in the
cache -- as opposed to just setting local variables -- is causing you
problems. You don't need to use the cache to manipulate CMAKE_C_FLAGS,
so I'm not sure why you would do so.

hth,
tyler


More information about the CMake mailing list