@@ -19,12 +19,19 @@ set (CMAKE_LINKER_FLAGS_DEBUG "${CMAKE_LINKER_FLAGS_DEBUG} -fsanitize=address")
19
19
# stand-alone application and library interface
20
20
21
21
macro (set_asar_shared_properties target msvc_lib_type_param enable_sanitizer)
22
+ # this is here because in CMake you can't modify macro parameters
23
+ # so we create a new variable
24
+ set (msvc_lib_type_var ${msvc_lib_type_param} )
22
25
if (MSVC )
23
26
if (MSVC_LIB_TYPE)
24
- set (msvc_lib_type_param ${MSVC_LIB_TYPE} )
27
+ set (msvc_lib_type_var ${MSVC_LIB_TYPE} )
25
28
endif ()
26
- if (NOT (${msvc_lib_type_param} STREQUAL "D" OR ${msvc_lib_type_param} STREQUAL "T" ))
27
- message (FATAL_ERROR "Invalid MSVC_LIB_TYPE, valid types are T and D" )
29
+ if ("${msvc_lib_type_var} " STREQUAL "D" )
30
+ set_property (TARGET ${target} PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL" )
31
+ elseif ("${msvc_lib_type_var} " STREQUAL "T" )
32
+ set_property (TARGET ${target} PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>" )
33
+ else ()
34
+ message (FATAL_ERROR "Invalid MSVC_LIB_TYPE, valid types are T and D instead of ${msvc_lib_type_var} " )
28
35
endif ()
29
36
endif ()
30
37
@@ -74,7 +81,7 @@ macro(set_asar_shared_properties target msvc_lib_type_param enable_sanitizer)
74
81
# Enable maximum warning level
75
82
76
83
if (MSVC )
77
- target_compile_options (${target} PRIVATE /Wall "/M ${msvc_lib_type_param} $<$<CONFIG:Debug>:d>" /EHa)
84
+ target_compile_options (${target} PRIVATE /W3 /EHa)
78
85
79
86
# These certainly aren't worth a warning, though
80
87
target_compile_options (${target} PRIVATE
@@ -83,6 +90,8 @@ macro(set_asar_shared_properties target msvc_lib_type_param enable_sanitizer)
83
90
/wd4711 # function selected for automatic inline expansion
84
91
/wd4820 # 'bytes' bytes padding added after construct 'member_name'
85
92
/wd4464 # relativ include path contains '..'
93
+ /wd4244 # 'conversion' conversion from 'type1' to 'type2', possible loss of data
94
+ /wd5045 # compiler will insert Spectre mitigation for memory load if /Qspectre switch specified
86
95
)
87
96
target_link_options (${target} PRIVATE /STACK:4194304)
88
97
if (MSVC_VERSION VERSION_LESS "1900" )
0 commit comments