From a80aaf184186b878b9cb8970b674bd81f7ab90ca Mon Sep 17 00:00:00 2001 From: Davis King Date: Sun, 27 Sep 2015 20:27:51 -0400 Subject: [PATCH] Added missing file --- ..._visual_studio_to_use_static_runtime.cmake | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 dlib/tell_visual_studio_to_use_static_runtime.cmake diff --git a/dlib/tell_visual_studio_to_use_static_runtime.cmake b/dlib/tell_visual_studio_to_use_static_runtime.cmake new file mode 100644 index 000000000..43232cf4b --- /dev/null +++ b/dlib/tell_visual_studio_to_use_static_runtime.cmake @@ -0,0 +1,19 @@ + +# Including this cmake script into your cmake project will cause visual studio +# to build your project against the static C runtime. + +cmake_minimum_required(VERSION 2.6.4) +if (POLICY CMP0054) + cmake_policy(SET CMP0054 NEW) +endif() + +if (MSVC OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") + foreach(flag_var + CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE + CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO) + if(${flag_var} MATCHES "/MD") + string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}") + endif() + endforeach(flag_var) +endif() +