From 8e2edb53755fe4d8fee224ac8cfb49d25a4eed14 Mon Sep 17 00:00:00 2001 From: Zachary Lund Date: Fri, 10 Aug 2018 15:25:30 -0700 Subject: [PATCH] cmake: Add option to use static runtime --- CMakeLists.txt | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4a991b0b6..2c168072e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,24 +36,12 @@ list(APPEND obs-browser_LIBRARIES ${CEF_LIBRARIES}) if(MSVC) - string(REPLACE "/MD" "/MT" - "CMAKE_C_FLAGS" - "${CMAKE_C_FLAGS}") - - string(REPLACE "/MD" "/MT" - "CMAKE_CXX_FLAGS" - "${CMAKE_CXX_FLAGS}") - - string(TOUPPER "${CMAKE_CONFIGURATION_TYPES}" UPPER_CONFIG_TYPES) - foreach(CONFIG_TYPE ${UPPER_CONFIG_TYPES}) - string(REPLACE "/MD" "/MT" - "CMAKE_C_FLAGS_${CONFIG_TYPE}" - "${CMAKE_C_FLAGS_${CONFIG_TYPE}}") - - string(REPLACE "/MD" "/MT" - "CMAKE_CXX_FLAGS_${CONFIG_TYPE}" - "${CMAKE_CXX_FLAGS_${CONFIG_TYPE}}") - endforeach() + option(BROWSER_USE_STATIC_CRT "Use static CRT" ON) + + if(BROWSER_USE_STATIC_CRT) + add_compile_options($,/MTd,/MT>) + endif() + list(APPEND obs-browser_LIBRARIES d3d11 dxgi