[MEDIA][CMAKE] Create add_driver_inf cmake function
[reactos.git] / sdk / cmake / CMakeMacros.cmake
1
2 # set_cpp
3 # Marks the current folder as containing C++ modules, additionally enabling
4 # specific C++ language features as specified (all of these default to off):
5 #
6 # WITH_RUNTIME
7 # Links with the C++ runtime. Enable this for modules which use new/delete or
8 # RTTI, but do not require STL. This is the right choice if you see undefined
9 # references to operator new/delete, vector constructor/destructor iterator,
10 # type_info::vtable, ...
11 # Note: this only affects linking, so cannot be used for static libraries.
12 # WITH_RTTI
13 # Enables run-time type information. Enable this if the module uses typeid or
14 # dynamic_cast. You will probably need to enable WITH_RUNTIME as well, if
15 # you're not already using STL.
16 # WITH_EXCEPTIONS
17 # Enables C++ exception handling. Enable this if the module uses try/catch or
18 # throw. You might also need this if you use a standard operator new (the one
19 # without nothrow).
20 # WITH_STL
21 # Enables standard C++ headers and links to the Standard Template Library.
22 # Use this for modules using anything from the std:: namespace, e.g. maps,
23 # strings, vectors, etc.
24 # Note: this affects both compiling (via include directories) and
25 # linking (by adding STL). Implies WITH_RUNTIME.
26 # FIXME: WITH_STL is currently also required for runtime headers such as
27 # <new> and <exception>. This is not a big issue because in stl-less
28 # environments you usually don't want those anyway; but we might want
29 # to have modules like this in the future.
30 #
31 # Examples:
32 # set_cpp()
33 # Enables the C++ language, but will cause errors if any runtime or standard
34 # library features are used. This should be the default for C++ in kernel
35 # mode or otherwise restricted environments.
36 # Note: this is required to get libgcc (for multiplication/division) linked
37 # in for C++ modules, and to set the correct language for precompiled
38 # header files, so it IS required even with no features specified.
39 # set_cpp(WITH_RUNTIME)
40 # Links with the C++ runtime, so that e.g. custom operator new implementations
41 # can be used in a restricted environment. This is also required for linking
42 # with libraries (such as ATL) which have RTTI enabled, even if the module in
43 # question does not use WITH_RTTI.
44 # set_cpp(WITH_RTTI WITH_EXCEPTIONS WITH_STL)
45 # The full package. This will adjust compiler and linker so that all C++
46 # features can be used.
47 macro(set_cpp)
48 cmake_parse_arguments(__cppopts "WITH_RUNTIME;WITH_RTTI;WITH_EXCEPTIONS;WITH_STL" "" "" ${ARGN})
49 if(__cppopts_UNPARSED_ARGUMENTS)
50 message(FATAL_ERROR "set_cpp: unparsed arguments ${__cppopts_UNPARSED_ARGUMENTS}")
51 endif()
52
53 if(__cppopts_WITH_RUNTIME)
54 set(CPP_USE_RT 1)
55 endif()
56 if(__cppopts_WITH_RTTI)
57 if(MSVC)
58 replace_compile_flags("/GR-" "/GR")
59 else()
60 replace_compile_flags_language("-fno-rtti" "-frtti" "CXX")
61 endif()
62 endif()
63 if(__cppopts_WITH_EXCEPTIONS)
64 if(MSVC)
65 replace_compile_flags("/EHs-c-" "/EHsc")
66 else()
67 replace_compile_flags_language("-fno-exceptions" "-fexceptions" "CXX")
68 endif()
69 endif()
70 if(__cppopts_WITH_STL)
71 set(CPP_USE_STL 1)
72 if(MSVC)
73 add_definitions(-DNATIVE_CPP_INCLUDE=${REACTOS_SOURCE_DIR}/sdk/include/c++)
74 include_directories(${REACTOS_SOURCE_DIR}/sdk/include/c++/stlport)
75 else()
76 replace_compile_flags("-nostdinc" " ")
77 add_definitions(-DPAL_STDCPP_COMPAT)
78 endif()
79 endif()
80
81 set(IS_CPP 1)
82 endmacro()
83
84 function(add_dependency_node _node)
85 if(GENERATE_DEPENDENCY_GRAPH)
86 get_target_property(_type ${_node} TYPE)
87 if(_type MATCHES SHARED_LIBRARY|MODULE_LIBRARY OR ${_node} MATCHES ntoskrnl)
88 file(APPEND ${REACTOS_BINARY_DIR}/dependencies.graphml " <node id=\"${_node}\"/>\n")
89 endif()
90 endif()
91 endfunction()
92
93 function(add_dependency_edge _source _target)
94 if(GENERATE_DEPENDENCY_GRAPH)
95 get_target_property(_type ${_source} TYPE)
96 if(_type MATCHES SHARED_LIBRARY|MODULE_LIBRARY)
97 file(APPEND ${REACTOS_BINARY_DIR}/dependencies.graphml " <edge source=\"${_source}\" target=\"${_target}\"/>\n")
98 endif()
99 endif()
100 endfunction()
101
102 function(add_dependency_header)
103 file(WRITE ${REACTOS_BINARY_DIR}/dependencies.graphml "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<graphml>\n <graph id=\"ReactOS dependencies\" edgedefault=\"directed\">\n")
104 endfunction()
105
106 function(add_dependency_footer)
107 add_dependency_node(ntdll)
108 file(APPEND ${REACTOS_BINARY_DIR}/dependencies.graphml " </graph>\n</graphml>\n")
109 endfunction()
110
111 function(add_message_headers _type)
112 if(${_type} STREQUAL UNICODE)
113 set(_flag "-U")
114 else()
115 set(_flag "-A")
116 endif()
117 foreach(_file ${ARGN})
118 get_filename_component(_file_name ${_file} NAME_WE)
119 set(_converted_file ${CMAKE_CURRENT_BINARY_DIR}/${_file}) ## ${_file_name}.mc
120 set(_source_file ${CMAKE_CURRENT_SOURCE_DIR}/${_file}) ## ${_file_name}.mc
121 add_custom_command(
122 OUTPUT "${_converted_file}"
123 COMMAND native-utf16le "${_source_file}" "${_converted_file}" nobom
124 DEPENDS native-utf16le "${_source_file}")
125 macro_mc(${_flag} ${_converted_file})
126 add_custom_command(
127 OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_file_name}.h ${CMAKE_CURRENT_BINARY_DIR}/${_file_name}.rc
128 COMMAND ${COMMAND_MC}
129 DEPENDS "${_converted_file}")
130 set_source_files_properties(
131 ${CMAKE_CURRENT_BINARY_DIR}/${_file_name}.h ${CMAKE_CURRENT_BINARY_DIR}/${_file_name}.rc
132 PROPERTIES GENERATED TRUE)
133 add_custom_target(${_file_name} ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${_file_name}.h ${CMAKE_CURRENT_BINARY_DIR}/${_file_name}.rc)
134 endforeach()
135 endfunction()
136
137 function(add_link)
138 cmake_parse_arguments(_LINK "MINIMIZE" "NAME;PATH;CMD_LINE_ARGS;ICON;GUID" "" ${ARGN})
139 if(NOT _LINK_NAME OR NOT _LINK_PATH)
140 message(FATAL_ERROR "You must provide name and path")
141 endif()
142
143 if(_LINK_CMD_LINE_ARGS)
144 set(_LINK_CMD_LINE_ARGS -c ${_LINK_CMD_LINE_ARGS})
145 endif()
146
147 if(_LINK_ICON)
148 set(_LINK_ICON -i ${_LINK_ICON})
149 endif()
150
151 if(_LINK_GUID)
152 set(_LINK_GUID -g ${_LINK_GUID})
153 endif()
154
155 if(_LINK_MINIMIZE)
156 set(_LINK_MINIMIZE "-m")
157 endif()
158
159 add_custom_command(
160 OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_LINK_NAME}.lnk
161 COMMAND native-mkshelllink -o ${CMAKE_CURRENT_BINARY_DIR}/${_LINK_NAME}.lnk ${_LINK_CMD_LINE_ARGS} ${_LINK_ICON} ${_LINK_GUID} ${_LINK_MINIMIZE} ${_LINK_PATH}
162 DEPENDS native-mkshelllink)
163 set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${_LINK_NAME}.lnk PROPERTIES GENERATED TRUE)
164 endfunction()
165
166 #
167 # WARNING!
168 # Please keep the numbering in this list in sync with
169 # boot/bootdata/packages/reactos.dff.in
170 #
171 macro(dir_to_num dir var)
172 if(${dir} STREQUAL reactos)
173 set(${var} 1)
174 elseif(${dir} STREQUAL reactos/system32)
175 set(${var} 2)
176 elseif(${dir} STREQUAL reactos/system32/drivers)
177 set(${var} 3)
178 elseif(${dir} STREQUAL reactos/Fonts)
179 set(${var} 4)
180 elseif(${dir} STREQUAL reactos/system32/drivers/etc)
181 set(${var} 5)
182 elseif(${dir} STREQUAL reactos/inf)
183 set(${var} 6)
184 elseif(${dir} STREQUAL reactos/bin)
185 set(${var} 7)
186 elseif(${dir} STREQUAL reactos/bin/testdata)
187 set(${var} 8)
188 elseif(${dir} STREQUAL reactos/bin/suppl)
189 set(${var} 80)
190 elseif(${dir} STREQUAL reactos/media)
191 set(${var} 9)
192 elseif(${dir} STREQUAL reactos/Microsoft.NET)
193 set(${var} 10)
194 elseif(${dir} STREQUAL reactos/Microsoft.NET/Framework)
195 set(${var} 11)
196 elseif(${dir} STREQUAL reactos/Microsoft.NET/Framework/v1.0.3705)
197 set(${var} 12)
198 elseif(${dir} STREQUAL reactos/Microsoft.NET/Framework/v1.1.4322)
199 set(${var} 13)
200 elseif(${dir} STREQUAL reactos/Microsoft.NET/Framework/v2.0.50727)
201 set(${var} 14)
202 elseif(${dir} STREQUAL reactos/Resources)
203 set(${var} 15)
204 elseif(${dir} STREQUAL reactos/Resources/Themes)
205 set(${var} 16)
206 elseif(${dir} STREQUAL reactos/system32/wbem)
207 set(${var} 17)
208 elseif(${dir} STREQUAL reactos/Resources/Themes/Lautus)
209 set(${var} 18)
210 elseif(${dir} STREQUAL reactos/Help)
211 set(${var} 19)
212 elseif(${dir} STREQUAL reactos/Config)
213 set(${var} 20)
214 elseif(${dir} STREQUAL reactos/Cursors)
215 set(${var} 21)
216 elseif(${dir} STREQUAL reactos/system32/ShellExt)
217 set(${var} 22)
218 elseif(${dir} STREQUAL reactos/Temp)
219 set(${var} 23)
220 elseif(${dir} STREQUAL reactos/system32/spool)
221 set(${var} 24)
222 elseif(${dir} STREQUAL reactos/system32/spool/drivers)
223 set(${var} 25)
224 elseif(${dir} STREQUAL reactos/system32/spool/drivers/color)
225 set(${var} 26)
226 elseif(${dir} STREQUAL reactos/system32/spool/drivers/w32x86)
227 set(${var} 27)
228 elseif(${dir} STREQUAL reactos/system32/spool/drivers/w32x86/3)
229 set(${var} 28)
230 elseif(${dir} STREQUAL reactos/system32/spool/prtprocs)
231 set(${var} 29)
232 elseif(${dir} STREQUAL reactos/system32/spool/prtprocs/w32x86)
233 set(${var} 30)
234 elseif(${dir} STREQUAL reactos/system32/spool/PRINTERS)
235 set(${var} 31)
236 elseif(${dir} STREQUAL reactos/system32/wbem/Repository)
237 set(${var} 32)
238 elseif(${dir} STREQUAL reactos/system32/wbem/Repository/FS)
239 set(${var} 33)
240 elseif(${dir} STREQUAL reactos/system32/wbem/mof/good)
241 set(${var} 34)
242 elseif(${dir} STREQUAL reactos/system32/wbem/mof/bad)
243 set(${var} 35)
244 elseif(${dir} STREQUAL reactos/system32/wbem/AdStatus)
245 set(${var} 36)
246 elseif(${dir} STREQUAL reactos/system32/wbem/xml)
247 set(${var} 37)
248 elseif(${dir} STREQUAL reactos/system32/wbem/Logs)
249 set(${var} 38)
250 elseif(${dir} STREQUAL reactos/system32/wbem/AutoRecover)
251 set(${var} 39)
252 elseif(${dir} STREQUAL reactos/system32/wbem/snmp)
253 set(${var} 40)
254 elseif(${dir} STREQUAL reactos/system32/wbem/Performance)
255 set(${var} 41)
256 elseif(${dir} STREQUAL reactos/twain_32)
257 set(${var} 42)
258 elseif(${dir} STREQUAL reactos/repair)
259 set(${var} 43)
260 elseif(${dir} STREQUAL reactos/Web)
261 set(${var} 44)
262 elseif(${dir} STREQUAL reactos/Web/Wallpaper)
263 set(${var} 45)
264 elseif(${dir} STREQUAL reactos/Prefetch)
265 set(${var} 46)
266 elseif(${dir} STREQUAL reactos/security)
267 set(${var} 47)
268 elseif(${dir} STREQUAL reactos/security/Database)
269 set(${var} 48)
270 elseif(${dir} STREQUAL reactos/security/logs)
271 set(${var} 49)
272 elseif(${dir} STREQUAL reactos/security/templates)
273 set(${var} 50)
274 elseif(${dir} STREQUAL reactos/system32/CatRoot)
275 set(${var} 51)
276 elseif(${dir} STREQUAL reactos/system32/CatRoot2)
277 set(${var} 52)
278 elseif(${dir} STREQUAL reactos/AppPatch)
279 set(${var} 53)
280 elseif(${dir} STREQUAL reactos/winsxs)
281 set(${var} 54)
282 elseif(${dir} STREQUAL reactos/winsxs/manifests)
283 set(${var} 55)
284 elseif(${dir} STREQUAL reactos/winsxs/x86_microsoft.windows.common-controls_6595b64144ccf1df_5.82.2600.2982_none_deadbeef)
285 set(${var} 56)
286 elseif(${dir} STREQUAL reactos/winsxs/x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.2600.2982_none_deadbeef)
287 set(${var} 57)
288 elseif(${dir} STREQUAL reactos/winsxs/x86_microsoft.windows.gdiplus_6595b64144ccf1df_1.1.7601.23038_none_deadbeef)
289 set(${var} 58)
290 elseif(${dir} STREQUAL reactos/winsxs/x86_reactos.apisets_6595b64144ccf1df_1.0.0.0_none_deadbeef)
291 set(${var} 59)
292 elseif(${dir} STREQUAL reactos/winsxs/x86_reactos.newapi_6595b64144ccf1df_1.0.0.0_none_deadbeef)
293 set(${var} 60)
294 elseif(${dir} STREQUAL reactos/winsxs/x86_microsoft.windows.gdiplus_6595b64144ccf1df_1.0.14393.0_none_deadbeef)
295 set(${var} 61)
296 elseif(${dir} STREQUAL reactos/Resources/Themes/Modern)
297 set(${var} 62)
298 elseif(${dir} STREQUAL reactos/3rdParty)
299 set(${var} 63)
300 elseif(${dir} STREQUAL reactos/Resources/Themes/Lunar)
301 set(${var} 64)
302 elseif(${dir} STREQUAL reactos/Resources/Themes/Mizu)
303 set(${var} 65)
304 elseif(${dir} STREQUAL reactos/system32/spool/prtprocs/x64)
305 set(${var} 66)
306 else()
307 message(FATAL_ERROR "Wrong destination: ${dir}")
308 endif()
309 endmacro()
310
311 function(add_cd_file)
312 cmake_parse_arguments(_CD "NO_CAB;NOT_IN_HYBRIDCD" "DESTINATION;NAME_ON_CD;TARGET" "FILE;FOR" ${ARGN})
313 if(NOT (_CD_TARGET OR _CD_FILE))
314 message(FATAL_ERROR "You must provide a target or a file to install!")
315 endif()
316
317 if(NOT _CD_DESTINATION)
318 message(FATAL_ERROR "You must provide a destination")
319 elseif(${_CD_DESTINATION} STREQUAL root)
320 set(_CD_DESTINATION "")
321 endif()
322
323 if(NOT _CD_FOR)
324 message(FATAL_ERROR "You must provide a cd name (or \"all\" for all of them) to install the file on!")
325 endif()
326
327 # get file if we need to
328 if(NOT _CD_FILE)
329 set(_CD_FILE "$<TARGET_FILE:${_CD_TARGET}>")
330 if(NOT _CD_NAME_ON_CD)
331 set(_CD_NAME_ON_CD "$<TARGET_FILE_NAME:${_CD_TARGET}>")
332 endif()
333 endif()
334
335 # do we add it to all CDs?
336 list(FIND _CD_FOR all __cd)
337 if(NOT __cd EQUAL -1)
338 list(REMOVE_AT _CD_FOR __cd)
339 list(INSERT _CD_FOR __cd "bootcd;livecd;regtest")
340 endif()
341
342 # do we add it to bootcd?
343 list(FIND _CD_FOR bootcd __cd)
344 if(NOT __cd EQUAL -1)
345 # whether or not we should put it in reactos.cab or directly on cd
346 if(_CD_NO_CAB)
347 # directly on cd
348 foreach(item ${_CD_FILE})
349 if(_CD_NAME_ON_CD)
350 # rename it in the cd tree
351 set(__file ${_CD_NAME_ON_CD})
352 else()
353 get_filename_component(__file ${item} NAME)
354 endif()
355 set_property(GLOBAL APPEND PROPERTY BOOTCD_FILE_LIST "${_CD_DESTINATION}/${__file}=${item}")
356 # add it also into the hybridcd if not specified otherwise
357 if(NOT _CD_NOT_IN_HYBRIDCD)
358 set_property(GLOBAL APPEND PROPERTY HYBRIDCD_FILE_LIST "bootcd/${_CD_DESTINATION}/${__file}=${item}")
359 endif()
360 endforeach()
361 # manage dependency
362 if(_CD_TARGET)
363 add_dependencies(bootcd ${_CD_TARGET} registry_inf)
364 endif()
365 else()
366 # add it in reactos.cab
367 dir_to_num(${_CD_DESTINATION} _num)
368 file(APPEND ${REACTOS_BINARY_DIR}/boot/bootdata/packages/reactos.dff.cmake "\"${_CD_FILE}\" ${_num}\n")
369 # manage dependency - target level
370 if(_CD_TARGET)
371 add_dependencies(reactos_cab_inf ${_CD_TARGET})
372 endif()
373 # manage dependency - file level
374 set_property(GLOBAL APPEND PROPERTY REACTOS_CAB_DEPENDS ${_CD_FILE})
375 endif()
376 endif() #end bootcd
377
378 # do we add it to livecd?
379 list(FIND _CD_FOR livecd __cd)
380 if(NOT __cd EQUAL -1)
381 # manage dependency
382 if(_CD_TARGET)
383 add_dependencies(livecd ${_CD_TARGET} registry_inf)
384 endif()
385 foreach(item ${_CD_FILE})
386 if(_CD_NAME_ON_CD)
387 # rename it in the cd tree
388 set(__file ${_CD_NAME_ON_CD})
389 else()
390 get_filename_component(__file ${item} NAME)
391 endif()
392 set_property(GLOBAL APPEND PROPERTY LIVECD_FILE_LIST "${_CD_DESTINATION}/${__file}=${item}")
393 # add it also into the hybridcd if not specified otherwise
394 if(NOT _CD_NOT_IN_HYBRIDCD)
395 set_property(GLOBAL APPEND PROPERTY HYBRIDCD_FILE_LIST "livecd/${_CD_DESTINATION}/${__file}=${item}")
396 endif()
397 endforeach()
398 endif() #end livecd
399
400 # do we need also to add it to hybridcd?
401 list(FIND _CD_FOR hybridcd __cd)
402 if(NOT __cd EQUAL -1)
403 # manage dependency
404 if(_CD_TARGET)
405 add_dependencies(hybridcd ${_CD_TARGET})
406 endif()
407 foreach(item ${_CD_FILE})
408 if(_CD_NAME_ON_CD)
409 # rename it in the cd tree
410 set(__file ${_CD_NAME_ON_CD})
411 else()
412 get_filename_component(__file ${item} NAME)
413 endif()
414 set_property(GLOBAL APPEND PROPERTY HYBRIDCD_FILE_LIST "${_CD_DESTINATION}/${__file}=${item}")
415 endforeach()
416 endif() #end hybridcd
417
418 # do we add it to regtest?
419 list(FIND _CD_FOR regtest __cd)
420 if(NOT __cd EQUAL -1)
421 # whether or not we should put it in reactos.cab or directly on cd
422 if(_CD_NO_CAB)
423 # directly on cd
424 foreach(item ${_CD_FILE})
425 if(_CD_NAME_ON_CD)
426 # rename it in the cd tree
427 set(__file ${_CD_NAME_ON_CD})
428 else()
429 get_filename_component(__file ${item} NAME)
430 endif()
431 set_property(GLOBAL APPEND PROPERTY BOOTCDREGTEST_FILE_LIST "${_CD_DESTINATION}/${__file}=${item}")
432 endforeach()
433 # manage dependency
434 if(_CD_TARGET)
435 add_dependencies(bootcdregtest ${_CD_TARGET} registry_inf)
436 endif()
437 else()
438 #add it in reactos.cab
439 #dir_to_num(${_CD_DESTINATION} _num)
440 #file(APPEND ${REACTOS_BINARY_DIR}/boot/bootdata/packages/reactos.dff.dyn "${_CD_FILE} ${_num}\n")
441 #if(_CD_TARGET)
442 # #manage dependency
443 # add_dependencies(reactos_cab ${_CD_TARGET})
444 #endif()
445 endif()
446 endif() #end bootcd
447 endfunction()
448
449 function(create_iso_lists)
450 # generate reactos.cab before anything else
451 get_property(_filelist GLOBAL PROPERTY REACTOS_CAB_DEPENDS)
452
453 # begin with reactos.inf. We want this command to be always executed, so we pretend it generates another file although it will never do.
454 add_custom_command(
455 OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/reactos.inf ${CMAKE_CURRENT_BINARY_DIR}/__some_non_existent_file
456 COMMAND ${CMAKE_COMMAND} -E copy_if_different ${REACTOS_BINARY_DIR}/boot/bootdata/packages/reactos.inf ${CMAKE_CURRENT_BINARY_DIR}/reactos.inf
457 DEPENDS ${REACTOS_BINARY_DIR}/boot/bootdata/packages/reactos.inf reactos_cab_inf)
458
459 add_custom_command(
460 OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/reactos.cab
461 COMMAND native-cabman -C ${REACTOS_BINARY_DIR}/boot/bootdata/packages/reactos.dff -RC ${CMAKE_CURRENT_BINARY_DIR}/reactos.inf -N -P ${REACTOS_SOURCE_DIR}
462 DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/reactos.inf native-cabman ${_filelist})
463
464 add_custom_target(reactos_cab DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/reactos.cab)
465 add_dependencies(reactos_cab reactos_cab_inf)
466
467 add_cd_file(
468 TARGET reactos_cab
469 FILE ${CMAKE_CURRENT_BINARY_DIR}/reactos.cab
470 DESTINATION reactos
471 NO_CAB FOR bootcd regtest)
472
473 add_cd_file(
474 FILE ${CMAKE_CURRENT_BINARY_DIR}/livecd.iso
475 DESTINATION livecd
476 FOR hybridcd)
477
478 get_property(_filelist GLOBAL PROPERTY BOOTCD_FILE_LIST)
479 string(REPLACE ";" "\n" _filelist "${_filelist}")
480 file(APPEND ${REACTOS_BINARY_DIR}/boot/bootcd.cmake.lst "${_filelist}")
481 unset(_filelist)
482 file(GENERATE
483 OUTPUT ${REACTOS_BINARY_DIR}/boot/bootcd.$<CONFIG>.lst
484 INPUT ${REACTOS_BINARY_DIR}/boot/bootcd.cmake.lst)
485
486 get_property(_filelist GLOBAL PROPERTY LIVECD_FILE_LIST)
487 string(REPLACE ";" "\n" _filelist "${_filelist}")
488 file(APPEND ${REACTOS_BINARY_DIR}/boot/livecd.cmake.lst "${_filelist}")
489 unset(_filelist)
490 file(GENERATE
491 OUTPUT ${REACTOS_BINARY_DIR}/boot/livecd.$<CONFIG>.lst
492 INPUT ${REACTOS_BINARY_DIR}/boot/livecd.cmake.lst)
493
494 get_property(_filelist GLOBAL PROPERTY HYBRIDCD_FILE_LIST)
495 string(REPLACE ";" "\n" _filelist "${_filelist}")
496 file(APPEND ${REACTOS_BINARY_DIR}/boot/hybridcd.cmake.lst "${_filelist}")
497 unset(_filelist)
498 file(GENERATE
499 OUTPUT ${REACTOS_BINARY_DIR}/boot/hybridcd.$<CONFIG>.lst
500 INPUT ${REACTOS_BINARY_DIR}/boot/hybridcd.cmake.lst)
501
502 get_property(_filelist GLOBAL PROPERTY BOOTCDREGTEST_FILE_LIST)
503 string(REPLACE ";" "\n" _filelist "${_filelist}")
504 file(APPEND ${REACTOS_BINARY_DIR}/boot/bootcdregtest.cmake.lst "${_filelist}")
505 unset(_filelist)
506 file(GENERATE
507 OUTPUT ${REACTOS_BINARY_DIR}/boot/bootcdregtest.$<CONFIG>.lst
508 INPUT ${REACTOS_BINARY_DIR}/boot/bootcdregtest.cmake.lst)
509 endfunction()
510
511 # Create module_clean targets
512 function(add_clean_target _target)
513 set(_clean_working_directory ${CMAKE_CURRENT_BINARY_DIR})
514 if(CMAKE_GENERATOR STREQUAL "Unix Makefiles" OR CMAKE_GENERATOR STREQUAL "MinGW Makefiles")
515 set(_clean_command make clean)
516 elseif(CMAKE_GENERATOR STREQUAL "NMake Makefiles")
517 set(_clean_command nmake /nologo clean)
518 elseif(CMAKE_GENERATOR STREQUAL "Ninja")
519 set(_clean_command ninja -t clean ${_target})
520 set(_clean_working_directory ${REACTOS_BINARY_DIR})
521 endif()
522 add_custom_target(${_target}_clean
523 COMMAND ${_clean_command}
524 WORKING_DIRECTORY ${_clean_working_directory}
525 COMMENT "Cleaning ${_target}")
526 endfunction()
527
528 if(NOT MSVC_IDE)
529 function(add_library name)
530 _add_library(${name} ${ARGN})
531 add_clean_target(${name})
532 # cmake adds a module_EXPORTS define when compiling a module or a shared library. We don't use that.
533 get_target_property(_type ${name} TYPE)
534 if (_type MATCHES SHARED_LIBRARY|MODULE_LIBRARY)
535 set_target_properties(${name} PROPERTIES DEFINE_SYMBOL "")
536 endif()
537 endfunction()
538
539 function(add_executable name)
540 _add_executable(${name} ${ARGN})
541 add_clean_target(${name})
542 endfunction()
543 elseif(USE_FOLDER_STRUCTURE)
544 set_property(GLOBAL PROPERTY USE_FOLDERS ON)
545 string(LENGTH ${CMAKE_SOURCE_DIR} CMAKE_SOURCE_DIR_LENGTH)
546
547 function(add_custom_target name)
548 _add_custom_target(${name} ${ARGN})
549 string(SUBSTRING ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_SOURCE_DIR_LENGTH} -1 CMAKE_CURRENT_SOURCE_DIR_RELATIVE)
550 set_property(TARGET "${name}" PROPERTY FOLDER "${CMAKE_CURRENT_SOURCE_DIR_RELATIVE}")
551 endfunction()
552
553 function(add_library name)
554 _add_library(${name} ${ARGN})
555 get_target_property(_target_excluded ${name} EXCLUDE_FROM_ALL)
556 if(_target_excluded AND ${name} MATCHES "^lib.*")
557 set_property(TARGET "${name}" PROPERTY FOLDER "Importlibs")
558 else()
559 string(SUBSTRING ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_SOURCE_DIR_LENGTH} -1 CMAKE_CURRENT_SOURCE_DIR_RELATIVE)
560 set_property(TARGET "${name}" PROPERTY FOLDER "${CMAKE_CURRENT_SOURCE_DIR_RELATIVE}")
561 endif()
562 # cmake adds a module_EXPORTS define when compiling a module or a shared library. We don't use that.
563 get_target_property(_type ${name} TYPE)
564 if (_type MATCHES SHARED_LIBRARY|MODULE_LIBRARY)
565 set_target_properties(${name} PROPERTIES DEFINE_SYMBOL "")
566 endif()
567 endfunction()
568
569 function(add_executable name)
570 _add_executable(${name} ${ARGN})
571 string(SUBSTRING ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_SOURCE_DIR_LENGTH} -1 CMAKE_CURRENT_SOURCE_DIR_RELATIVE)
572 set_property(TARGET "${name}" PROPERTY FOLDER "${CMAKE_CURRENT_SOURCE_DIR_RELATIVE}")
573 endfunction()
574 else()
575 function(add_library name)
576 _add_library(${name} ${ARGN})
577 # cmake adds a module_EXPORTS define when compiling a module or a shared library. We don't use that.
578 get_target_property(_type ${name} TYPE)
579 if (_type MATCHES SHARED_LIBRARY|MODULE_LIBRARY)
580 set_target_properties(${name} PROPERTIES DEFINE_SYMBOL "")
581 endif()
582 endfunction()
583 endif()
584
585 if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
586 function(concatenate_files _output _file1)
587 file(TO_NATIVE_PATH "${_output}" _real_output)
588 file(TO_NATIVE_PATH "${_file1}" _file_list)
589 foreach(_file ${ARGN})
590 file(TO_NATIVE_PATH "${_file}" _real_file)
591 set(_file_list "${_file_list} + ${_real_file}")
592 endforeach()
593 add_custom_command(
594 OUTPUT ${_output}
595 COMMAND cmd.exe /C "copy /Y /B ${_file_list} ${_real_output} > nul"
596 DEPENDS ${_file1} ${ARGN})
597 endfunction()
598 else()
599 macro(concatenate_files _output)
600 add_custom_command(
601 OUTPUT ${_output}
602 COMMAND cat ${ARGN} > ${_output}
603 DEPENDS ${ARGN})
604 endmacro()
605 endif()
606
607 function(add_importlibs _module)
608 add_dependency_node(${_module})
609 foreach(LIB ${ARGN})
610 if("${LIB}" MATCHES "msvcrt")
611 target_compile_definitions(${_module} PRIVATE _DLL __USE_CRTIMP)
612 target_link_libraries(${_module} msvcrtex)
613 endif()
614 target_link_libraries(${_module} lib${LIB})
615 add_dependencies(${_module} lib${LIB})
616 add_dependency_edge(${_module} ${LIB})
617 endforeach()
618 endfunction()
619
620 function(set_module_type MODULE TYPE)
621 cmake_parse_arguments(__module "UNICODE" "IMAGEBASE" "ENTRYPOINT" ${ARGN})
622
623 if(__module_UNPARSED_ARGUMENTS)
624 message(STATUS "set_module_type : unparsed arguments ${__module_UNPARSED_ARGUMENTS}, module : ${MODULE}")
625 endif()
626
627 # Add the module to the module group list, if it is defined
628 if(DEFINED CURRENT_MODULE_GROUP)
629 set_property(GLOBAL APPEND PROPERTY ${CURRENT_MODULE_GROUP}_MODULE_LIST "${MODULE}")
630 endif()
631
632 # Set subsystem. Also take this as an occasion
633 # to error out if someone gave a non existing type
634 if((${TYPE} STREQUAL nativecui) OR (${TYPE} STREQUAL nativedll)
635 OR (${TYPE} STREQUAL kernelmodedriver) OR (${TYPE} STREQUAL wdmdriver) OR (${TYPE} STREQUAL kerneldll))
636 set(__subsystem native)
637 elseif(${TYPE} STREQUAL win32cui)
638 set(__subsystem console)
639 elseif(${TYPE} STREQUAL win32gui)
640 set(__subsystem windows)
641 elseif(NOT ((${TYPE} STREQUAL win32dll) OR (${TYPE} STREQUAL win32ocx)
642 OR (${TYPE} STREQUAL cpl) OR (${TYPE} STREQUAL module)))
643 message(FATAL_ERROR "Unknown type ${TYPE} for module ${MODULE}")
644 endif()
645
646 if(DEFINED __subsystem)
647 set_subsystem(${MODULE} ${__subsystem})
648 endif()
649
650 # Set the PE image version numbers from the NT OS version ReactOS is based on
651 if (MSVC)
652 add_target_link_flags(${MODULE} "/VERSION:5.01")
653 else()
654 add_target_link_flags(${MODULE} "-Wl,--major-image-version,5 -Wl,--minor-image-version,01")
655 add_target_link_flags(${MODULE} "-Wl,--major-os-version,5 -Wl,--minor-os-version,01")
656 endif()
657
658 # Set unicode definitions
659 if(__module_UNICODE)
660 target_compile_definitions(${MODULE} PRIVATE UNICODE _UNICODE)
661 endif()
662
663 # Set entry point
664 if(__module_ENTRYPOINT OR (__module_ENTRYPOINT STREQUAL "0"))
665 list(GET __module_ENTRYPOINT 0 __entrypoint)
666 list(LENGTH __module_ENTRYPOINT __length)
667 if(${__length} EQUAL 2)
668 list(GET __module_ENTRYPOINT 1 __entrystack)
669 elseif(NOT ${__length} EQUAL 1)
670 message(FATAL_ERROR "Wrong arguments for ENTRYPOINT parameter of set_module_type : ${__module_ENTRYPOINT}")
671 endif()
672 unset(__length)
673 elseif(${TYPE} STREQUAL nativecui)
674 set(__entrypoint NtProcessStartup)
675 set(__entrystack 4)
676 elseif(${TYPE} STREQUAL win32cui)
677 if(__module_UNICODE)
678 set(__entrypoint wmainCRTStartup)
679 else()
680 set(__entrypoint mainCRTStartup)
681 endif()
682 elseif(${TYPE} STREQUAL win32gui)
683 if(__module_UNICODE)
684 set(__entrypoint wWinMainCRTStartup)
685 else()
686 set(__entrypoint WinMainCRTStartup)
687 endif()
688 elseif((${TYPE} STREQUAL win32dll) OR (${TYPE} STREQUAL win32ocx)
689 OR (${TYPE} STREQUAL cpl))
690 set(__entrypoint DllMainCRTStartup)
691 set(__entrystack 12)
692 elseif((${TYPE} STREQUAL kernelmodedriver) OR (${TYPE} STREQUAL wdmdriver))
693 set(__entrypoint DriverEntry)
694 set(__entrystack 8)
695 elseif(${TYPE} STREQUAL nativedll)
696 set(__entrypoint DllMain)
697 set(__entrystack 12)
698 elseif(${TYPE} STREQUAL module)
699 set(__entrypoint 0)
700 endif()
701
702 if(DEFINED __entrypoint)
703 if(DEFINED __entrystack)
704 set_entrypoint(${MODULE} ${__entrypoint} ${__entrystack})
705 else()
706 set_entrypoint(${MODULE} ${__entrypoint})
707 endif()
708 endif()
709
710 # Set base address
711 if(__module_IMAGEBASE)
712 set_image_base(${MODULE} ${__module_IMAGEBASE})
713 elseif(${TYPE} STREQUAL win32dll)
714 if(DEFINED baseaddress_${MODULE})
715 set_image_base(${MODULE} ${baseaddress_${MODULE}})
716 else()
717 message(STATUS "${MODULE} has no base address")
718 endif()
719 elseif((${TYPE} STREQUAL kernelmodedriver) OR (${TYPE} STREQUAL wdmdriver) OR (${TYPE} STREQUAL kerneldll))
720 set_image_base(${MODULE} 0x00010000)
721 endif()
722
723 # Now do some stuff which is specific to each type
724 if((${TYPE} STREQUAL kernelmodedriver) OR (${TYPE} STREQUAL wdmdriver) OR (${TYPE} STREQUAL kerneldll))
725 add_dependencies(${MODULE} bugcodes xdk)
726 if((${TYPE} STREQUAL kernelmodedriver) OR (${TYPE} STREQUAL wdmdriver))
727 set_target_properties(${MODULE} PROPERTIES SUFFIX ".sys")
728 endif()
729 endif()
730
731 if(${TYPE} STREQUAL win32ocx)
732 set_target_properties(${MODULE} PROPERTIES SUFFIX ".ocx")
733 endif()
734
735 if(${TYPE} STREQUAL cpl)
736 set_target_properties(${MODULE} PROPERTIES SUFFIX ".cpl")
737 endif()
738
739 # Do compiler specific stuff
740 set_module_type_toolchain(${MODULE} ${TYPE})
741 endfunction()
742
743 function(start_module_group __name)
744 if(DEFINED CURRENT_MODULE_GROUP)
745 message(FATAL_ERROR "CURRENT_MODULE_GROUP is already set ('${CURRENT_MODULE_GROUP}')")
746 endif()
747 set(CURRENT_MODULE_GROUP ${__name} PARENT_SCOPE)
748 endfunction()
749
750 function(end_module_group)
751 get_property(__modulelist GLOBAL PROPERTY ${CURRENT_MODULE_GROUP}_MODULE_LIST)
752 add_custom_target(${CURRENT_MODULE_GROUP})
753 foreach(__module ${__modulelist})
754 add_dependencies(${CURRENT_MODULE_GROUP} ${__module})
755 endforeach()
756 set(CURRENT_MODULE_GROUP PARENT_SCOPE)
757 endfunction()
758
759 function(preprocess_file __in __out)
760 set(__arg ${__in})
761 foreach(__def ${ARGN})
762 list(APPEND __arg -D${__def})
763 endforeach()
764 if(MSVC)
765 add_custom_command(OUTPUT ${_out}
766 COMMAND ${CMAKE_C_COMPILER} /EP ${__arg}
767 DEPENDS ${__in})
768 else()
769 add_custom_command(OUTPUT ${_out}
770 COMMAND ${CMAKE_C_COMPILER} -E ${__arg}
771 DEPENDS ${__in})
772 endif()
773 endfunction()
774
775 function(get_includes OUTPUT_VAR)
776 get_directory_property(_includes INCLUDE_DIRECTORIES)
777 foreach(arg ${_includes})
778 list(APPEND __tmp_var -I${arg})
779 endforeach()
780 set(${OUTPUT_VAR} ${__tmp_var} PARENT_SCOPE)
781 endfunction()
782
783 function(get_defines OUTPUT_VAR)
784 get_directory_property(_defines COMPILE_DEFINITIONS)
785 foreach(arg ${_defines})
786 list(APPEND __tmp_var -D${arg})
787 endforeach()
788 set(${OUTPUT_VAR} ${__tmp_var} PARENT_SCOPE)
789 endfunction()
790
791 if(NOT MSVC)
792 function(add_object_library _target)
793 add_library(${_target} OBJECT ${ARGN})
794 endfunction()
795 else()
796 function(add_object_library _target)
797 add_library(${_target} ${ARGN})
798 endfunction()
799 endif()
800
801 function(add_registry_inf)
802 # Add to the inf files list
803 foreach(_file ${ARGN})
804 set(_source_file "${CMAKE_CURRENT_SOURCE_DIR}/${_file}")
805 set_property(GLOBAL APPEND PROPERTY REGISTRY_INF_LIST ${_source_file})
806 endforeach()
807 endfunction()
808
809 function(create_registry_hives)
810
811 # Shortcut to the registry.inf file
812 set(_registry_inf "${CMAKE_BINARY_DIR}/boot/bootdata/registry.inf")
813
814 # Get the list of inf files
815 get_property(_inf_files GLOBAL PROPERTY REGISTRY_INF_LIST)
816
817 # Convert files to utf16le
818 foreach(_file ${_inf_files})
819 get_filename_component(_file_name ${_file} NAME_WE)
820 string(REPLACE ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} _converted_file "${_file}")
821 string(REPLACE ${_file_name} "${_file_name}_utf16" _converted_file ${_converted_file})
822 add_custom_command(OUTPUT ${_converted_file}
823 COMMAND native-utf16le ${_file} ${_converted_file}
824 DEPENDS native-utf16le ${_file})
825 list(APPEND _converted_files ${_converted_file})
826 endforeach()
827
828 # Concatenate all registry files to registry.inf
829 concatenate_files(${_registry_inf} ${_converted_files})
830
831 # Add registry.inf to bootcd
832 add_custom_target(registry_inf DEPENDS ${_registry_inf})
833 add_cd_file(TARGET registry_inf
834 FILE ${_registry_inf}
835 DESTINATION reactos
836 NO_CAB
837 FOR bootcd regtest)
838
839 # BootCD setup system hive
840 add_custom_command(
841 OUTPUT ${CMAKE_BINARY_DIR}/boot/bootdata/SETUPREG.HIV
842 COMMAND native-mkhive -h:SETUPREG -u -d:${CMAKE_BINARY_DIR}/boot/bootdata ${CMAKE_BINARY_DIR}/boot/bootdata/hivesys_utf16.inf ${CMAKE_SOURCE_DIR}/boot/bootdata/setupreg.inf
843 DEPENDS native-mkhive ${CMAKE_BINARY_DIR}/boot/bootdata/hivesys_utf16.inf)
844
845 add_custom_target(bootcd_hives
846 DEPENDS ${CMAKE_BINARY_DIR}/boot/bootdata/SETUPREG.HIV)
847
848 add_cd_file(
849 FILE ${CMAKE_BINARY_DIR}/boot/bootdata/SETUPREG.HIV
850 TARGET bootcd_hives
851 DESTINATION reactos
852 NO_CAB
853 FOR bootcd regtest)
854
855 # LiveCD hives
856 list(APPEND _livecd_inf_files
857 ${_registry_inf}
858 ${CMAKE_SOURCE_DIR}/boot/bootdata/livecd.inf)
859 if(SARCH STREQUAL "xbox")
860 list(APPEND _livecd_inf_files
861 ${CMAKE_SOURCE_DIR}/boot/bootdata/hiveinst_xbox.inf)
862 else()
863 list(APPEND _livecd_inf_files
864 ${CMAKE_SOURCE_DIR}/boot/bootdata/hiveinst.inf)
865 endif()
866
867 add_custom_command(
868 OUTPUT ${CMAKE_BINARY_DIR}/boot/bootdata/system
869 ${CMAKE_BINARY_DIR}/boot/bootdata/software
870 ${CMAKE_BINARY_DIR}/boot/bootdata/default
871 ${CMAKE_BINARY_DIR}/boot/bootdata/sam
872 ${CMAKE_BINARY_DIR}/boot/bootdata/security
873 COMMAND native-mkhive -h:SYSTEM,SOFTWARE,DEFAULT,SAM,SECURITY -d:${CMAKE_BINARY_DIR}/boot/bootdata ${_livecd_inf_files}
874 DEPENDS native-mkhive ${_livecd_inf_files})
875
876 add_custom_target(livecd_hives
877 DEPENDS ${CMAKE_BINARY_DIR}/boot/bootdata/system
878 ${CMAKE_BINARY_DIR}/boot/bootdata/software
879 ${CMAKE_BINARY_DIR}/boot/bootdata/default
880 ${CMAKE_BINARY_DIR}/boot/bootdata/sam
881 ${CMAKE_BINARY_DIR}/boot/bootdata/security)
882
883 add_cd_file(
884 FILE ${CMAKE_BINARY_DIR}/boot/bootdata/system
885 ${CMAKE_BINARY_DIR}/boot/bootdata/software
886 ${CMAKE_BINARY_DIR}/boot/bootdata/default
887 ${CMAKE_BINARY_DIR}/boot/bootdata/sam
888 ${CMAKE_BINARY_DIR}/boot/bootdata/security
889 TARGET livecd_hives
890 DESTINATION reactos/system32/config
891 FOR livecd)
892
893 # BCD Hive
894 add_custom_command(
895 OUTPUT ${CMAKE_BINARY_DIR}/boot/bootdata/BCD
896 COMMAND native-mkhive -h:BCD -u -d:${CMAKE_BINARY_DIR}/boot/bootdata ${CMAKE_BINARY_DIR}/boot/bootdata/hivebcd_utf16.inf
897 DEPENDS native-mkhive ${CMAKE_BINARY_DIR}/boot/bootdata/hivebcd_utf16.inf)
898
899 add_custom_target(bcd_hive
900 DEPENDS ${CMAKE_BINARY_DIR}/boot/bootdata/BCD)
901
902 add_cd_file(
903 FILE ${CMAKE_BINARY_DIR}/boot/bootdata/BCD
904 TARGET bcd_hive
905 DESTINATION efi/boot
906 NO_CAB
907 FOR bootcd regtest livecd)
908
909 endfunction()
910
911 function(add_driver_inf _module)
912 # Add to the inf files list
913 foreach(_file ${ARGN})
914 set(_converted_item ${CMAKE_CURRENT_BINARY_DIR}/${_file})
915 set(_source_item ${CMAKE_CURRENT_SOURCE_DIR}/${_file})
916 add_custom_command(OUTPUT "${_converted_item}"
917 COMMAND native-utf16le "${_source_item}" "${_converted_item}"
918 DEPENDS native-utf16le "${_source_item}")
919 add_cd_file(FILE ${_converted_item} DESTINATION reactos/inf FOR all)
920 list(APPEND _converted_inf_files ${_converted_item})
921 endforeach()
922
923 add_custom_target(${_module}_inf_files DEPENDS ${_converted_inf_files})
924 endfunction()
925
926 if(KDBG)
927 set(ROSSYM_LIB "rossym")
928 else()
929 set(ROSSYM_LIB "")
930 endif()
931
932 function(add_rc_deps _target_rc)
933 set_source_files_properties(${_target_rc} PROPERTIES OBJECT_DEPENDS "${ARGN}")
934 endfunction()
935
936 add_custom_target(rostests_install COMMAND ${CMAKE_COMMAND} -DCOMPONENT=rostests -P ${CMAKE_BINARY_DIR}/cmake_install.cmake)
937 function(add_rostests_file)
938 cmake_parse_arguments(_ROSTESTS "" "RENAME;SUBDIR;TARGET" "FILE" ${ARGN})
939 if(NOT (_ROSTESTS_TARGET OR _ROSTESTS_FILE))
940 message(FATAL_ERROR "You must provide a target or a file to install!")
941 endif()
942
943 set(_ROSTESTS_NAME_ON_CD "${_ROSTESTS_RENAME}")
944 if(NOT _ROSTESTS_FILE)
945 set(_ROSTESTS_FILE "$<TARGET_FILE:${_ROSTESTS_TARGET}>")
946 if(NOT _ROSTESTS_RENAME)
947 set(_ROSTESTS_NAME_ON_CD "$<TARGET_FILE_NAME:${_ROSTESTS_TARGET}>")
948 endif()
949 else()
950 if(NOT _ROSTESTS_RENAME)
951 get_filename_component(_ROSTESTS_NAME_ON_CD ${_ROSTESTS_FILE} NAME)
952 endif()
953 endif()
954
955 if(_ROSTESTS_SUBDIR)
956 set(_ROSTESTS_SUBDIR "/${_ROSTESTS_SUBDIR}")
957 endif()
958
959 if(_ROSTESTS_TARGET)
960 add_cd_file(TARGET ${_ROSTESTS_TARGET} FILE ${_ROSTESTS_FILE} DESTINATION "reactos/bin${_ROSTESTS_SUBDIR}" NAME_ON_CD ${_ROSTESTS_NAME_ON_CD} FOR all)
961 else()
962 add_cd_file(FILE ${_ROSTESTS_FILE} DESTINATION "reactos/bin${_ROSTESTS_SUBDIR}" NAME_ON_CD ${_ROSTESTS_NAME_ON_CD} FOR all)
963 endif()
964
965 if(DEFINED ENV{ROSTESTS_INSTALL})
966 if(_ROSTESTS_RENAME)
967 install(FILES ${_ROSTESTS_FILE} DESTINATION "$ENV{ROSTESTS_INSTALL}${_ROSTESTS_SUBDIR}" COMPONENT rostests RENAME ${_ROSTESTS_RENAME})
968 else()
969 install(FILES ${_ROSTESTS_FILE} DESTINATION "$ENV{ROSTESTS_INSTALL}${_ROSTESTS_SUBDIR}" COMPONENT rostests)
970 endif()
971 endif()
972 endfunction()