c++visual-studiowindows-runtimesfml

Compile SFML with /MT flag in Visual Studio


I am using Visual Studio 2012 and I want to compile my graphics application, which uses the SFML framework, with the /MT compiler flag instead of the Visual Studio default /MD. This can be set up in the project settings at Configuration -> C/C++ -> Code Generation -> Runtime Library. The mentioned flag controls whether to dynamically (/MD) or statically (/MT) link the Windows runtime library.

Changing just this settings in the project file of my own application results in linker errors because the value of RuntimeLibrary is set to MD_DynamicRelease in SFML but it is MT_StaticRelease in my project. Therefore I need to compile SFML with the /MT flag. I created the Visual Studio project file using CMake but in the project settings there are much less settings. The point is that there isn't even a category Configuration -> C/C++.

So how can I find the options page or set the /MT flag manually?

(By the way the names of the options pages might not be perfectly correct since I translated them from the German version of Visual Studio I sadly use.)


Solution

  • The CMake scripts provided with SFML come with an option to link the runtime libraries statically (SFML_USE_STATIC_STD_LIBS).