[CMAKE]
[reactos.git] / reactos / boot / bootdata / packages / CMakeLists.txt
1 #reactos.dff
2
3 # reactos.dff is the concatenation of two files :
4 # - reactos.dff.in, which is a static one and can be altered to
5 # add custom modules/files to reactos.cab
6 # - reactos.dff.dyn (dyn as dynamic) which is generated at configure time by our cmake scripts
7 # If you want to slip-stream anything into the bootcd, then you want to alter reactos.dff.in
8
9 # Idea taken from there : http://www.cmake.org/pipermail/cmake/2010-July/038028.html
10 file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/concat.cmake "
11 file(READ \${SRC1} S1)
12 file(READ \${SRC2} S2)
13 file(WRITE \${DST} \"\${S1}\${S2}\")
14 ")
15
16 file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/reactos.dff.dyn "")
17
18 # This finalizes reactos.dff by concat-ing the two files: one generated and one static containing the optional file.
19 # please keep it this way as it permits to add files to reactos.dff.in without having to run cmake again
20 # and also avoids rebuilding reactos.cab in case nothing changes after a cmake run
21 add_custom_command(
22 OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/reactos.dff
23 COMMAND ${CMAKE_COMMAND} -D SRC1=${CMAKE_CURRENT_SOURCE_DIR}/reactos.dff.in
24 -D SRC2=${CMAKE_CURRENT_BINARY_DIR}/reactos.dff.dyn
25 -D DST=${CMAKE_CURRENT_BINARY_DIR}/reactos.dff.maydiff
26 -P ${CMAKE_CURRENT_BINARY_DIR}/concat.cmake
27 COMMAND ${CMAKE_COMMAND} -E copy_if_different
28 ${CMAKE_CURRENT_BINARY_DIR}/reactos.dff.maydiff
29 ${CMAKE_CURRENT_BINARY_DIR}/reactos.dff
30 DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/reactos.dff.in
31 DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/reactos.dff.dyn)
32
33 add_custom_target(
34 reactos_cab_inf
35 COMMAND native-cabman -C ${CMAKE_CURRENT_BINARY_DIR}/reactos.dff -L ${CMAKE_CURRENT_BINARY_DIR} -I -P ${REACTOS_SOURCE_DIR}
36 DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/reactos.dff native-cabman)
37
38 add_cd_file(
39 TARGET reactos_cab_inf
40 FILE ${CMAKE_CURRENT_BINARY_DIR}/reactos.inf
41 DESTINATION reactos
42 NO_CAB FOR bootcd regtest)