[CMake] Recompile with different flags

Matthew Woehlke mw_triad at users.sourceforge.net
Mon Jan 19 17:40:20 EST 2009


Adam Weiss wrote:
> I couldn't find an answer to this, so I thought I should ask.
> 
> I have a set of source files that are compiled and built into a library.
> Works great.
> Now I want to recompile those same files with a compiler flag added into
> another library.  Don't ask, this is how it has to be.
> 
> I tried doing add_library, then set_source_files_properties, then
> add_library but then the flag is set for both.
> 
> I would like to keep it all inside of one CMakeLists.txt file, but I might
> be able to work it out another way.

I have a project with similar requirements. Can you arrange for the 
additional flags to be ignored by any other sources in the second 
library? (If they're definitions, this shouldn't be too hard, if they're 
e.g. optimization flags, that might be an issue.) If so, you can set 
properties on the target (the library) instead of the sources.

This either works, or I haven't looked closely enough at my build :-).

-- 
Matthew
Please do not quote my e-mail address unobfuscated in message bodies.
-- 
morphir: so much confusion :S kmake, kdemake, qmake make cmake etc.
logixoul: you forgot cmakekde :)
morphir: and bakemeacake



More information about the CMake mailing list