@@ -11,10 +11,8 @@ function( windows_options )
1111
1212 option ( GODOT_USE_STATIC_CPP "Link MinGW/MSVC C++ runtime libraries statically" ON )
1313
14- # The below scons variables are controlled via toolchain files instead
15- # "mingw_prefix" "MinGW prefix"
16- # "use_llvm" "Use the LLVM compiler (MVSC or MinGW depending on the use_mingw flag)"
17- # "use_mingw" "Use the MinGW compiler instead of MSVC - only effective on Windows"
14+ option ( GODOT_DEBUG_CRT "Compile with MSVC's debug CRT (/MDd)" OFF )
15+
1816endfunction ()
1917
2018function ( windows_generate TARGET_NAME )
@@ -23,27 +21,21 @@ function( windows_generate TARGET_NAME )
2321 set ( NOT_MSVC "$<NOT:${IS_MSVC} >" )
2422 set ( STATIC_CPP "$<BOOL:${GODOT_USE_STATIC_CPP} >" )
2523 set ( DISABLE_EXCEPTIONS "$<BOOL:${GODOT_DISABLE_EXCEPTIONS} >" )
24+ set ( DEBUG_CRT "$<BOOL:${GODOT_DEBUG_CRT} >" )
2625
2726 set_target_properties ( ${TARGET_NAME}
2827 PROPERTIES
2928 PDB_OUTPUT_DIRECTORY "$<1:${CMAKE_SOURCE_DIR} /bin>"
29+ INTERFACE_MSVC_RUNTIME_LIBRARY
30+ "$<IF:${DEBUG_CRT} ,MultiThreadedDebugDLL,$<IF:${STATIC_CPP} ,MultiThreaded,MultiThreadedDLL>>"
3031 )
3132
3233 target_compile_definitions ( ${TARGET_NAME}
3334 PUBLIC
3435 WINDOWS_ENABLED
35- $<${IS_MSVC} :
36- TYPED_METHOD_BIND
37- NOMINMAX
38- >
36+ $<${IS_MSVC} : TYPED_METHOD_BIND NOMINMAX >
3937 )
4038
41- target_compile_options ( ${TARGET_NAME}
42- PUBLIC
43- $<${IS_MSVC} :
44- $<IF:${STATIC_CPP} ,/MT,/MD >$<${IS_DEV} :d> # Link microsoft runtime
45- >
46- )
4739 target_link_options ( ${TARGET_NAME}
4840 PUBLIC
4941
0 commit comments