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

Tyler Roscoe tyler at cryptio.net
Wed Sep 30 12:02:00 EDT 2009


Wow, nice bump.

On Wed, Sep 30, 2009 at 05:58:50PM +0200, Tanguy Krotoff wrote:
> I have several projects and I want to statically link one of them with
> the Visual C++ libraries.
> i.e I want to replace the Visual C++ /MD flag by /MT only in this
> specific projet, not the others.
> 
> > Can you do something like this:
> >
> > set (CMAKE_CXX_FLAGS_ORIG CMAKE_CXX_FLAGS)
> > string (REPLACE "foo" "bar" ${CMAKE_CXX_FLAGS} CMAKE_CXX_FLAGS)
> > add_library (baz ${src_files})
> > set (CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_ORIG)
> >
> > ?
> 
> This does not work.

Can you be more specific? What does your CMakeLists look like and what
command line does the compiler end up with?

tyler


More information about the CMake mailing list