[CMake] Selecting runtime library on Visual Studio projects

Brad King brad.king at kitware.com
Thu Jul 13 09:32:18 EDT 2006


Sagnes, Frederic wrote:
> Hello,
> 
> I am building a project for Windows and Unix that relies on static multi threaded runtime library on Windows (static STLport needs it). I'm using Visual Studio .Net 2003 7.1
> 
> How can I switch the default libraries (/MD and MDd switches) to the static ones (/MT and /MTd switches).
> 
> I tried this code:
> 
> IF ( CMAKE_COMPILER_IS_MSVC )
> 	SET (
>     CMAKE_CXX_FLAGS_DEBUG
>       "${CMAKE_CXX_FLAGS_DEBUG} /MTd"
>   )
> 	SET (
>     CMAKE_CXX_FLAGS_RELEASE
>       "${CMAKE_CXX_FLAGS_RELEASE} /MT"
>   )
> ENDIF ( CMAKE_COMPILER_IS_MSVC )

I don't think there is any CMAKE_COMPILER_IS_MSVC variable, so even a
MESSAGE in this block will not show up.  Try

IF(MSVC)
  ...
ENDIF(MSVC)

-Brad


More information about the CMake mailing list