We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 2350

Summary: CMake build system should support using the static C runtime for non-shared builds of SDL
Product: SDL Reporter: Brad Davis <bdavis>
Component: buildAssignee: Ryan C. Gordon <icculus>
Status: ASSIGNED --- QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: 2.0.1   
Hardware: x86_64   
OS: Windows (All)   

Description Brad Davis 2014-01-17 08:06:27 UTC
On windows environments, in order to avoid having to deal with providing the Microsoft C runtime re-distributable, it's often desirable to be able to configure your code to use the static C runtime (use /MT and /MTd instead of /MD and /MDd).  This allows the developer to create a single executable that has no DLL dependencies.  


CMake doesn't appear to support this as a simple toggle, but there is some information out there on how to trigger this by manipulating the compiler flags (see http://stackoverflow.com/questions/10113017/setting-the-msvc-runtime-in-cmake ) and a number of other projects support this, notably OpenCV, which has it's own CMAKE setting flag for this (BUILD_WITH_STATIC_CRT) and encapsulates the logic required to accomplish it in this file:  https://github.com/Itseez/opencv/blob/master/cmake/OpenCVCRTLinkage.cmake