[CMake] Selecting runtime library on Visual Studio projects

Sagnes, Frederic frederic.sagnes at siemens.com
Thu Jul 13 08:28:15 EDT 2006


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 )

But nothing changed, the /MD and /MDd switches remain on the command line, the new ones don't even show up. Seems like VS or a CMake parser wipes my settings out, or the default settings can't be overwritten. Is there a special command or a workaround to achieve this?

Best regards

_______________________________________________

Frédéric Sagnes, A&D AS RD DH K3 Siemens AG Karlsruhe



More information about the CMake mailing list