Skip to content

Commit 8e2edb5

Browse files
cmake: Add option to use static runtime
1 parent c095627 commit 8e2edb5

File tree

1 file changed

+6
-18
lines changed

1 file changed

+6
-18
lines changed

CMakeLists.txt

+6-18
Original file line numberDiff line numberDiff line change
@@ -36,24 +36,12 @@ list(APPEND obs-browser_LIBRARIES
3636
${CEF_LIBRARIES})
3737

3838
if(MSVC)
39-
string(REPLACE "/MD" "/MT"
40-
"CMAKE_C_FLAGS"
41-
"${CMAKE_C_FLAGS}")
42-
43-
string(REPLACE "/MD" "/MT"
44-
"CMAKE_CXX_FLAGS"
45-
"${CMAKE_CXX_FLAGS}")
46-
47-
string(TOUPPER "${CMAKE_CONFIGURATION_TYPES}" UPPER_CONFIG_TYPES)
48-
foreach(CONFIG_TYPE ${UPPER_CONFIG_TYPES})
49-
string(REPLACE "/MD" "/MT"
50-
"CMAKE_C_FLAGS_${CONFIG_TYPE}"
51-
"${CMAKE_C_FLAGS_${CONFIG_TYPE}}")
52-
53-
string(REPLACE "/MD" "/MT"
54-
"CMAKE_CXX_FLAGS_${CONFIG_TYPE}"
55-
"${CMAKE_CXX_FLAGS_${CONFIG_TYPE}}")
56-
endforeach()
39+
option(BROWSER_USE_STATIC_CRT "Use static CRT" ON)
40+
41+
if(BROWSER_USE_STATIC_CRT)
42+
add_compile_options($<IF:$<CONFIG:Debug>,/MTd,/MT>)
43+
endif()
44+
5745
list(APPEND obs-browser_LIBRARIES
5846
d3d11
5947
dxgi

0 commit comments

Comments
 (0)