[CMAKE] Do not treat C4189 as an error when compiling with VS 2010, or when in releas...
[reactos.git] / reactos / cmake / msvc.cmake
1
2 #if(${CMAKE_BUILD_TYPE} STREQUAL "Debug")
3 if(CMAKE_BUILD_TYPE STREQUAL "Debug")
4 # no optimization
5 add_compile_flags("/Ob0 /Od")
6 elseif(CMAKE_BUILD_TYPE STREQUAL "Release")
7 add_compile_flags("/Ox /Ob2 /Ot /Oy /GT /GF")
8 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /OPT:REF /OPT:ICF")
9 set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /OPT:REF /OPT:ICF")
10 elseif(OPTIMIZE STREQUAL "1")
11 add_definitions(/O1)
12 elseif(OPTIMIZE STREQUAL "2")
13 add_definitions(/O2)
14 elseif(OPTIMIZE STREQUAL "3")
15 add_definitions(/Ot /Ox /GS-)
16 elseif(OPTIMIZE STREQUAL "4")
17 add_definitions(/Os /Ox /GS-)
18 elseif(OPTIMIZE STREQUAL "5")
19 add_definitions(/GF /Gy /Ob2 /Os /Ox /GS-)
20 endif()
21
22 if(ARCH STREQUAL "i386")
23 add_definitions(/DWIN32 /D_WINDOWS)
24 endif()
25
26 add_definitions(/Dinline=__inline /D__STDC__=1)
27
28 add_compile_flags("/X /GR- /EHs-c- /GS- /Zl /W3")
29
30 # HACK: for VS 11+ we need to explicitly disable SSE, which is off by
31 # default for older compilers. See CORE-6507
32 if(MSVC_VERSION GREATER 1699 AND ARCH STREQUAL "i386")
33 add_compile_flags("/arch:IA32")
34 endif ()
35
36 # VS 12+ requires /FS when used in parallel compilations
37 if(MSVC_VERSION GREATER 1799 AND NOT MSVC_IDE)
38 add_compile_flags("/FS")
39 endif ()
40
41 # VS14+ tries to use thread-safe initialization
42 if(MSVC_VERSION GREATER 1899)
43 add_compile_flags("/Zc:threadSafeInit-")
44 endif ()
45
46 # Disable overly sensitive warnings as well as those that generally aren't
47 # useful to us.
48 # - C4244: implicit integer truncation
49 # - C4290: C++ exception specification ignored
50 # - C4800: forcing value to bool 'true' or 'false' (performance warning)
51 #add_compile_flags("/wd4244 /wd4290 /wd4800 ")
52 add_compile_flags("/wd4244 /wd4290 /wd4800")
53
54 # The following warnings are treated as errors:
55 # - C4013: implicit function declaration
56 # - C4020: too many actual parameters
57 # - C4022: pointer type mismatch for parameter
58 # - TODO: C4028: formal parameter different from declaration
59 # - C4047: different level of indirection
60 # - TODO: C4090: different 'modifier' qualifiers (for C programs only;
61 # for C++ programs, the compiler error C2440 is issued)
62 # - C4098: void function returning a value
63 # - C4113: parameter lists differ
64 # - C4129: unrecognized escape sequence
65 # - TODO: C4133: incompatible types
66 # - C4163: 'identifier': not available as an intrinsic function
67 # - C4229: modifiers on data are ignored
68 # - C4700: uninitialized variable usage
69 # - C4603: macro is not defined or definition is different after precompiled header use
70 # - C4716: function must return a value
71 add_compile_flags("/we4013 /we4020 /we4022 /we4047 /we4098 /we4113 /we4129 /we4163 /we4229 /we4700 /we4603 /we4716")
72
73 # - C4189: local variable initialized but not referenced
74 # Not in Release mode and not with MSVC 2010
75 if((NOT CMAKE_BUILD_TYPE STREQUAL "Release") AND (NOT MSVC_VERSION LESS 1700))
76 add_compile_flags("/we4189")
77 endif()
78
79 # Enable warnings above the default level, but don't treat them as errors:
80 # - C4115: named type definition in parentheses
81 add_compile_flags("/w14115")
82
83 # Debugging
84 #if(${CMAKE_BUILD_TYPE} STREQUAL "Debug")
85 if(CMAKE_BUILD_TYPE STREQUAL "Debug")
86 if(NOT (_PREFAST_ OR _VS_ANALYZE_))
87 add_compile_flags("/Zi")
88 endif()
89 #elseif(${CMAKE_BUILD_TYPE} STREQUAL "Release")
90 elseif(CMAKE_BUILD_TYPE STREQUAL "Release")
91 add_definitions("/D NDEBUG")
92 endif()
93
94 if(MSVC_IDE AND (NOT DEFINED USE_FOLDER_STRUCTURE))
95 set(USE_FOLDER_STRUCTURE FALSE)
96 endif()
97
98 if(NOT DEFINED RUNTIME_CHECKS)
99 set(RUNTIME_CHECKS FALSE)
100 endif()
101
102 if(RUNTIME_CHECKS)
103 add_definitions(-D__RUNTIME_CHECKS__)
104 add_compile_flags("/RTC1")
105 endif()
106
107 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /MANIFEST:NO /INCREMENTAL:NO /SAFESEH:NO /NODEFAULTLIB /RELEASE")
108 set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /MANIFEST:NO /INCREMENTAL:NO /SAFESEH:NO /NODEFAULTLIB /RELEASE")
109 set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /MANIFEST:NO /INCREMENTAL:NO /SAFESEH:NO /NODEFAULTLIB /RELEASE")
110
111 if(CMAKE_DISABLE_NINJA_DEPSLOG)
112 set(cl_includes_flag "")
113 else()
114 set(cl_includes_flag "/showIncludes")
115 endif()
116
117 if(MSVC_IDE AND (CMAKE_VERSION MATCHES "ReactOS"))
118 # For VS builds we'll only have en-US in resource files
119 add_definitions(/DLANGUAGE_EN_US)
120 else()
121 # Only VS 10+ resource compiler supports /nologo
122 if(MSVC_VERSION GREATER 1599)
123 set(rc_nologo_flag "/nologo")
124 else()
125 set(rc_nologo_flag)
126 endif()
127 set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> ${rc_nologo_flag} <FLAGS> <DEFINES> ${I18N_DEFS} /fo<OBJECT> <SOURCE>")
128 if(ARCH STREQUAL "arm")
129 set(CMAKE_ASM_COMPILE_OBJECT
130 "cl ${cl_includes_flag} /nologo /X /I${REACTOS_SOURCE_DIR}/include/asm /I${REACTOS_BINARY_DIR}/include/asm <FLAGS> <DEFINES> /D__ASM__ /D_USE_ML /EP /c <SOURCE> > <OBJECT>.tmp"
131 "<CMAKE_ASM_COMPILER> -nologo -o <OBJECT> <OBJECT>.tmp")
132 else()
133 set(CMAKE_ASM_COMPILE_OBJECT
134 "cl ${cl_includes_flag} /nologo /X /I${REACTOS_SOURCE_DIR}/include/asm /I${REACTOS_BINARY_DIR}/include/asm <FLAGS> <DEFINES> /D__ASM__ /D_USE_ML /EP /c <SOURCE> > <OBJECT>.tmp"
135 "<CMAKE_ASM_COMPILER> /nologo /Cp /Fo<OBJECT> /c /Ta <OBJECT>.tmp")
136 endif()
137 endif()
138
139 if(_VS_ANALYZE_)
140 message("VS static analysis enabled!")
141 add_compile_flags("/analyze")
142 elseif(_PREFAST_)
143 message("PREFAST enabled!")
144 set(CMAKE_C_COMPILE_OBJECT "prefast <CMAKE_C_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO} <FLAGS> <DEFINES> /Fo<OBJECT> -c <SOURCE>${CMAKE_END_TEMP_FILE}"
145 "prefast LIST")
146 set(CMAKE_CXX_COMPILE_OBJECT "prefast <CMAKE_CXX_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO} <FLAGS> <DEFINES> /TP /Fo<OBJECT> -c <SOURCE>${CMAKE_END_TEMP_FILE}"
147 "prefast LIST")
148 set(CMAKE_C_LINK_EXECUTABLE
149 "<CMAKE_C_COMPILER> ${CMAKE_CL_NOLOGO} <OBJECTS> ${CMAKE_START_TEMP_FILE} <FLAGS> /Fe<TARGET> -link /implib:<TARGET_IMPLIB> /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>${CMAKE_END_TEMP_FILE}")
150 set(CMAKE_CXX_LINK_EXECUTABLE
151 "<CMAKE_CXX_COMPILER> ${CMAKE_CL_NOLOGO} <OBJECTS> ${CMAKE_START_TEMP_FILE} <FLAGS> /Fe<TARGET> -link /implib:<TARGET_IMPLIB> /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>${CMAKE_END_TEMP_FILE}")
152 endif()
153
154 set(CMAKE_RC_CREATE_SHARED_LIBRARY ${CMAKE_C_CREATE_SHARED_LIBRARY})
155 set(CMAKE_ASM_CREATE_SHARED_LIBRARY ${CMAKE_C_CREATE_SHARED_LIBRARY})
156 set(CMAKE_ASM_CREATE_STATIC_LIBRARY ${CMAKE_C_CREATE_STATIC_LIBRARY})
157
158 if(PCH)
159 macro(add_pch _target _pch _sources)
160
161 # Workaround for the MSVC toolchain (MSBUILD) /MP bug
162 set(_temp_gch ${CMAKE_CURRENT_BINARY_DIR}/${_target}.pch)
163 if(MSVC_IDE)
164 file(TO_NATIVE_PATH ${_temp_gch} _gch)
165 else()
166 set(_gch ${_temp_gch})
167 endif()
168
169 if(IS_CPP)
170 set(_pch_language CXX)
171 set(_cl_lang_flag "/TP")
172 else()
173 set(_pch_language C)
174 set(_cl_lang_flag "/TC")
175 endif()
176
177 if(MSVC_IDE)
178 set(_pch_path_name_flag "/Fp${_gch}")
179 endif()
180
181 # Build the precompiled header
182 # HEADER_FILE_ONLY FALSE: force compiling the header
183 set_source_files_properties(${_pch} PROPERTIES
184 HEADER_FILE_ONLY FALSE
185 LANGUAGE ${_pch_language}
186 COMPILE_FLAGS "${_cl_lang_flag} /Yc /Fp${_gch}"
187 OBJECT_OUTPUTS ${_gch})
188
189 # Prevent a race condition related to writing to the PDB files between the PCH and the excluded list of source files
190 get_target_property(_target_sources ${_target} SOURCES)
191 list(REMOVE_ITEM _target_sources ${_pch})
192 foreach(_target_src ${_target_sources})
193 set_property(SOURCE ${_target_src} APPEND PROPERTY OBJECT_DEPENDS ${_gch})
194 endforeach()
195
196 # Use the precompiled header with the specified source files, skipping the pch itself
197 list(REMOVE_ITEM ${_sources} ${_pch})
198 foreach(_src ${${_sources}})
199 set_property(SOURCE ${_src} APPEND_STRING PROPERTY COMPILE_FLAGS " /FI${_gch} /Yu${_gch} ${_pch_path_name_flag}")
200 endforeach()
201 endmacro()
202 else()
203 macro(add_pch _target _pch _sources)
204 endmacro()
205 endif()
206
207 function(set_entrypoint _module _entrypoint)
208 if(${_entrypoint} STREQUAL "0")
209 add_target_link_flags(${_module} "/NOENTRY")
210 elseif(ARCH STREQUAL "i386")
211 set(_entrysymbol ${_entrypoint})
212 if(${ARGC} GREATER 2)
213 set(_entrysymbol ${_entrysymbol}@${ARGV2})
214 endif()
215 add_target_link_flags(${_module} "/ENTRY:${_entrysymbol}")
216 else()
217 add_target_link_flags(${_module} "/ENTRY:${_entrypoint}")
218 endif()
219 endfunction()
220
221 function(set_subsystem MODULE SUBSYSTEM)
222 string(TOUPPER ${SUBSYSTEM} _subsystem)
223 if(ARCH STREQUAL "amd64")
224 add_target_link_flags(${MODULE} "/SUBSYSTEM:${_subsystem},5.02")
225 elseif(ARCH STREQUAL "arm")
226 add_target_link_flags(${MODULE} "/SUBSYSTEM:${_subsystem},6.02")
227 else()
228 add_target_link_flags(${MODULE} "/SUBSYSTEM:${_subsystem},5.01")
229 endif()
230 endfunction()
231
232 function(set_image_base MODULE IMAGE_BASE)
233 add_target_link_flags(${MODULE} "/BASE:${IMAGE_BASE}")
234 endfunction()
235
236 function(set_module_type_toolchain MODULE TYPE)
237 if(CPP_USE_STL)
238 if((${TYPE} STREQUAL "kernelmodedriver") OR (${TYPE} STREQUAL "wdmdriver"))
239 message(FATAL_ERROR "Use of STL in kernelmodedriver or wdmdriver type module prohibited")
240 endif()
241 target_link_libraries(${MODULE} cpprt stlport oldnames)
242 elseif(CPP_USE_RT)
243 target_link_libraries(${MODULE} cpprt)
244 endif()
245 if((${TYPE} STREQUAL "win32dll") OR (${TYPE} STREQUAL "win32ocx") OR (${TYPE} STREQUAL "cpl"))
246 add_target_link_flags(${MODULE} "/DLL")
247 elseif(${TYPE} STREQUAL "kernelmodedriver")
248 # Disable linker warning 4078 (multiple sections found with different attributes) for INIT section use
249 add_target_link_flags(${MODULE} "/DRIVER /IGNORE:4078")
250 elseif(${TYPE} STREQUAL "wdmdriver")
251 add_target_link_flags(${MODULE} "/DRIVER:WDM /IGNORE:4078")
252 endif()
253
254 if(RUNTIME_CHECKS)
255 target_link_libraries(${MODULE} runtmchk)
256 endif()
257
258 endfunction()
259
260 # Define those for having real libraries
261 set(CMAKE_IMPLIB_CREATE_STATIC_LIBRARY "LINK /LIB /NOLOGO <LINK_FLAGS> /OUT:<TARGET> <OBJECTS>")
262
263 if(ARCH STREQUAL "arm")
264 set(CMAKE_STUB_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> -nologo -o <OBJECT> <SOURCE>")
265 else()
266 set(CMAKE_STUB_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> /nologo /Cp /Fo<OBJECT> /c /Ta <SOURCE>")
267 endif()
268
269 function(add_delay_importlibs _module)
270 get_target_property(_module_type ${_module} TYPE)
271 if(_module_type STREQUAL "STATIC_LIBRARY")
272 message(FATAL_ERROR "Cannot add delay imports to a static library")
273 endif()
274 foreach(_lib ${ARGN})
275 add_target_link_flags(${_module} "/DELAYLOAD:${_lib}.dll")
276 target_link_libraries(${_module} lib${_lib})
277 endforeach()
278 target_link_libraries(${_module} delayimp)
279 endfunction()
280
281 function(generate_import_lib _libname _dllname _spec_file)
282
283 set(_def_file ${CMAKE_CURRENT_BINARY_DIR}/${_libname}_exp.def)
284 set(_asm_stubs_file ${CMAKE_CURRENT_BINARY_DIR}/${_libname}_stubs.asm)
285
286 # Generate the asm stub file and the def file for import library
287 add_custom_command(
288 OUTPUT ${_asm_stubs_file} ${_def_file}
289 COMMAND native-spec2def --ms -a=${SPEC2DEF_ARCH} --implib -n=${_dllname} -d=${_def_file} -l=${_asm_stubs_file} ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file}
290 DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file} native-spec2def)
291
292 if(MSVC_IDE)
293 # Compile the generated asm stub file
294 if(ARCH STREQUAL "arm")
295 set(_asm_stub_command ${CMAKE_ASM_COMPILER} -nologo -o ${_asm_stubs_file}.obj ${_asm_stubs_file})
296 else()
297 set(_asm_stub_command ${CMAKE_ASM_COMPILER} /Cp /Fo${_asm_stubs_file}.obj /c /Ta ${_asm_stubs_file})
298 endif()
299 add_custom_command(
300 OUTPUT ${_asm_stubs_file}.obj
301 COMMAND ${_asm_stub_command}
302 DEPENDS ${_asm_stubs_file})
303 else()
304 # Be clear about the "language"
305 # Thanks MS for creating a stupid linker
306 set_source_files_properties(${_asm_stubs_file} PROPERTIES LANGUAGE "STUB_ASM")
307 endif()
308
309 # Add our library
310 if(MSVC_IDE)
311 add_library(${_libname} STATIC EXCLUDE_FROM_ALL ${_asm_stubs_file}.obj)
312 set_source_files_properties(${_asm_stubs_file}.obj PROPERTIES EXTERNAL_OBJECT 1)
313 set_target_properties(${_libname} PROPERTIES LINKER_LANGUAGE "C")
314 else()
315 # NOTE: as stub file and def file are generated in one pass, depending on one is like depending on the other
316 add_library(${_libname} STATIC EXCLUDE_FROM_ALL ${_asm_stubs_file})
317 # set correct "link rule"
318 set_target_properties(${_libname} PROPERTIES LINKER_LANGUAGE "IMPLIB")
319 endif()
320 set_target_properties(${_libname} PROPERTIES STATIC_LIBRARY_FLAGS "/DEF:${_def_file}")
321 endfunction()
322
323 if(ARCH STREQUAL "amd64")
324 # This is NOT a typo.
325 # See https://software.intel.com/en-us/forums/topic/404643
326 add_definitions(/D__x86_64)
327 set(SPEC2DEF_ARCH x86_64)
328 elseif(ARCH STREQUAL "arm")
329 add_definitions(/D__arm__)
330 set(SPEC2DEF_ARCH arm)
331 else()
332 set(SPEC2DEF_ARCH i386)
333 endif()
334 function(spec2def _dllname _spec_file)
335
336 cmake_parse_arguments(__spec2def "ADD_IMPORTLIB;NO_PRIVATE_WARNINGS" "" "" ${ARGN})
337
338 # Get library basename
339 get_filename_component(_file ${_dllname} NAME_WE)
340
341 # Error out on anything else than spec
342 if(NOT ${_spec_file} MATCHES ".*\\.spec")
343 message(FATAL_ERROR "spec2def only takes spec files as input.")
344 endif()
345
346 # Generate exports def and C stubs file for the DLL
347 add_custom_command(
348 OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_file}.def ${CMAKE_CURRENT_BINARY_DIR}/${_file}_stubs.c
349 COMMAND native-spec2def --ms -a=${SPEC2DEF_ARCH} -n=${_dllname} -d=${CMAKE_CURRENT_BINARY_DIR}/${_file}.def -s=${CMAKE_CURRENT_BINARY_DIR}/${_file}_stubs.c ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file}
350 DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file} native-spec2def)
351
352 if(__spec2def_ADD_IMPORTLIB)
353 # TODO: NO_PRIVATE_WARNINGS should add /IGNORE:4104 to the link command
354 # line. However that should be on all command lines outside of
355 # generate_import_lib in the first place.
356 generate_import_lib(lib${_file} ${_dllname} ${_spec_file})
357 endif()
358 endfunction()
359
360 macro(macro_mc FLAG FILE)
361 set(COMMAND_MC ${CMAKE_MC_COMPILER} ${FLAG} -b ${CMAKE_CURRENT_SOURCE_DIR}/${FILE}.mc -r ${REACTOS_BINARY_DIR}/include/reactos -h ${REACTOS_BINARY_DIR}/include/reactos)
362 endmacro()
363
364 # PSEH workaround
365 set(PSEH_LIB "pseh")
366
367 # Use a full path for the x86 version of ml when using x64 VS.
368 # It's not a problem when using the DDK/WDK because, in x64 mode,
369 # both the x86 and x64 versions of ml are available.
370 if((ARCH STREQUAL "amd64") AND (DEFINED ENV{VCINSTALLDIR}))
371 set(CMAKE_ASM16_COMPILER $ENV{VCINSTALLDIR}/bin/ml.exe)
372 elseif(ARCH STREQUAL "arm")
373 set(CMAKE_ASM16_COMPILER armasm.exe)
374 else()
375 set(CMAKE_ASM16_COMPILER ml.exe)
376 endif()
377
378 function(CreateBootSectorTarget _target_name _asm_file _binary_file _base_address)
379 set(_object_file ${_binary_file}.obj)
380 set(_temp_file ${_binary_file}.tmp)
381
382 add_custom_command(
383 OUTPUT ${_temp_file}
384 COMMAND ${CMAKE_C_COMPILER} /nologo /X /I${REACTOS_SOURCE_DIR}/include/asm /I${REACTOS_BINARY_DIR}/include/asm /I${REACTOS_SOURCE_DIR}/boot/freeldr /D__ASM__ /D_USE_ML /EP /c ${_asm_file} > ${_temp_file}
385 DEPENDS ${_asm_file})
386
387 if(ARCH STREQUAL "arm")
388 set(_asm16_command ${CMAKE_ASM16_COMPILER} -nologo -o ${_object_file} ${_temp_file})
389 else()
390 set(_asm16_command ${CMAKE_ASM16_COMPILER} /nologo /Cp /Fo${_object_file} /c /Ta ${_temp_file})
391 endif()
392
393 add_custom_command(
394 OUTPUT ${_object_file}
395 COMMAND ${_asm16_command}
396 DEPENDS ${_temp_file})
397
398 add_custom_command(
399 OUTPUT ${_binary_file}
400 COMMAND native-obj2bin ${_object_file} ${_binary_file} ${_base_address}
401 DEPENDS ${_object_file} native-obj2bin)
402
403 set_source_files_properties(${_object_file} ${_temp_file} ${_binary_file} PROPERTIES GENERATED TRUE)
404
405 add_custom_target(${_target_name} ALL DEPENDS ${_binary_file})
406 endfunction()
407
408 function(allow_warnings __module)
409 endfunction()
410
411 macro(add_asm_files _target)
412 if(MSVC_IDE AND (CMAKE_VERSION MATCHES "ReactOS"))
413 get_defines(_directory_defines)
414 get_includes(_directory_includes)
415 get_directory_property(_defines COMPILE_DEFINITIONS)
416 foreach(_source_file ${ARGN})
417 get_filename_component(_source_file_base_name ${_source_file} NAME_WE)
418 get_filename_component(_source_file_full_path ${_source_file} ABSOLUTE)
419 set(_preprocessed_asm_file ${CMAKE_CURRENT_BINARY_DIR}/asm/${_source_file_base_name}_${_target}.tmp)
420 set(_object_file ${CMAKE_CURRENT_BINARY_DIR}/asm/${_source_file_base_name}_${_target}.obj)
421 get_source_file_property(_defines_semicolon_list ${_source_file_full_path} COMPILE_DEFINITIONS)
422 unset(_source_file_defines)
423 foreach(_define ${_defines_semicolon_list})
424 if(NOT ${_define} STREQUAL "NOTFOUND")
425 list(APPEND _source_file_defines -D${_define})
426 endif()
427 endforeach()
428 if(ARCH STREQUAL "arm")
429 set(_pp_asm_compile_command ${CMAKE_ASM_COMPILER} -nologo -o ${_object_file} ${_preprocessed_asm_file})
430 else()
431 set(_pp_asm_compile_command ${CMAKE_ASM_COMPILER} /nologo /Cp /Fo${_object_file} /c /Ta ${_preprocessed_asm_file})
432 endif()
433 add_custom_command(
434 OUTPUT ${_preprocessed_asm_file} ${_object_file}
435 COMMAND cl /nologo /X /I${REACTOS_SOURCE_DIR}/include/asm /I${REACTOS_BINARY_DIR}/include/asm ${_directory_includes} ${_source_file_defines} ${_directory_defines} /D__ASM__ /D_USE_ML /EP /c ${_source_file_full_path} > ${_preprocessed_asm_file} && ${_pp_asm_compile_command}
436 DEPENDS ${_source_file_full_path})
437 set_source_files_properties(${_object_file} PROPERTIES EXTERNAL_OBJECT 1)
438 list(APPEND ${_target} ${_object_file})
439 endforeach()
440 else()
441 list(APPEND ${_target} ${ARGN})
442 endif()
443 endmacro()