@@ -72,24 +72,47 @@ if(WITH_BLOCKS_RUNTIME)
72
72
SYSTEM BEFORE PRIVATE
73
73
"${WITH_BLOCKS_RUNTIME} " )
74
74
endif ()
75
- # TODO(compnerd) make this portable
76
- target_compile_options (dispatch PRIVATE -fno-exceptions)
75
+ if ("${CMAKE_C_SIMULATE_ID} " STREQUAL "MSVC" )
76
+ target_compile_options (dispatch PRIVATE /EHsc-)
77
+ else ()
78
+ target_compile_options (dispatch PRIVATE -fno-exceptions)
79
+ endif ()
77
80
if (DISPATCH_ENABLE_ASSERTS)
78
81
target_compile_definitions (dispatch
79
82
PRIVATE
80
83
-DDISPATCH_DEBUG=1)
81
84
endif ()
85
+ if (CMAKE_SYSTEM_NAME STREQUAL Windows)
86
+ target_compile_definitions (dispatch
87
+ PRIVATE
88
+ -D_CRT_SECURE_NO_WARNINGS)
89
+ endif ()
82
90
if (BSD_OVERLAY_FOUND)
83
91
target_compile_options (dispatch
84
92
PRIVATE
85
93
${BSD_OVERLAY_CFLAGS} )
86
94
endif ()
87
- # FIXME(compnerd) add check for -momit-leaf-frame-pointer?
88
- target_compile_options (dispatch
89
- PRIVATE
90
- -Wall
91
- -fblocks
92
- -momit-leaf-frame-pointer)
95
+ if ("${CMAKE_C_SIMULATE_ID} " STREQUAL "MSVC" )
96
+ target_compile_options (dispatch
97
+ PRIVATE
98
+ /W3)
99
+ else ()
100
+ target_compile_options (dispatch
101
+ PRIVATE
102
+ -Wall)
103
+ endif ()
104
+ # FIXME(compnerd) add check for -fblocks?
105
+ if ("${CMAKE_C_SIMULATE_ID} " STREQUAL "MSVC" )
106
+ target_compile_options (dispatch
107
+ PRIVATE
108
+ -Xclang -fblocks)
109
+ else ()
110
+ # FIXME(compnerd) add check for -momit-leaf-frame-pointer?
111
+ target_compile_options (dispatch
112
+ PRIVATE
113
+ -fblocks
114
+ -momit-leaf-frame-pointer)
115
+ endif ()
93
116
if (BSD_OVERLAY_FOUND)
94
117
target_link_libraries (dispatch PRIVATE ${BSD_OVERLAY_LDFLAGS} )
95
118
endif ()
0 commit comments