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

Tanguy Krotoff tkrotoff at gmail.com
Wed Sep 30 11:58:50 EDT 2009


I have the exact same problem.

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.

-- 
Tanguy Krotoff <tkrotoff at gmail.com>
+33 6 68 42 70 24


More information about the CMake mailing list