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 - CMake build system should support using the static C runtime for non-shared builds of SDL
Summary: CMake build system should support using the static C runtime for non-shared b...
Status: ASSIGNED
Alias: None
Product: SDL
Classification: Unclassified
Component: build (show other bugs)
Version: 2.0.1
Hardware: x86_64 Windows (All)
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-01-17 08:06 UTC by Brad Davis
Modified: 2014-02-23 01:50 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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