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