From 02997eb8f4daf96683824e1026fcf7d178f58a36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Sun, 29 Mar 2015 01:53:10 +0000 Subject: [PATCH] [CMAKE] Improve the concatenate_files macro introduced by Timo in r52179 + r52182 and hackfixed in r53914 . Notice that now it can take an arbitrary number of files to be concatenated. Hence you need to specify first the output file, and all the rest is the different files. [FREELDR] Use the improved concatenate_files macro. svn path=/trunk/; revision=66946 --- reactos/boot/freeldr/freeldr/CMakeLists.txt | 11 ++++--- reactos/cmake/CMakeMacros.cmake | 33 ++++----------------- 2 files changed, 13 insertions(+), 31 deletions(-) diff --git a/reactos/boot/freeldr/freeldr/CMakeLists.txt b/reactos/boot/freeldr/freeldr/CMakeLists.txt index 33ade8c016e..450a58af6be 100644 --- a/reactos/boot/freeldr/freeldr/CMakeLists.txt +++ b/reactos/boot/freeldr/freeldr/CMakeLists.txt @@ -226,10 +226,13 @@ endif() add_dependencies(freeldr_pe asm) add_dependencies(freeldr_pe_dbg asm) +# Retrieve the full path to the generated file of the 'freeldr_pe' target +get_target_property(_freeldr_pe_output_file freeldr_pe LOCATION) + concatenate_files( + ${CMAKE_CURRENT_BINARY_DIR}/freeldr.sys ${CMAKE_CURRENT_BINARY_DIR}/frldr16.bin - freeldr_pe - ${CMAKE_CURRENT_BINARY_DIR}/freeldr.sys) + ${_freeldr_pe_output_file}) add_custom_target(freeldr ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/freeldr.sys) @@ -238,9 +241,9 @@ add_cd_file(TARGET freeldr FILE ${CMAKE_CURRENT_BINARY_DIR}/freeldr.sys DESTINAT add_cd_file(TARGET freeldr FILE ${CMAKE_CURRENT_BINARY_DIR}/freeldr.sys DESTINATION loader NO_CAB NOT_IN_HYBRIDCD FOR livecd hybridcd NAME_ON_CD setupldr.sys) concatenate_files( + ${CMAKE_CURRENT_BINARY_DIR}/setupldr.sys ${CMAKE_CURRENT_BINARY_DIR}/frldr16.bin - freeldr_pe - ${CMAKE_CURRENT_BINARY_DIR}/setupldr.sys) + ${_freeldr_pe_output_file}) add_custom_target(setupldr ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/setupldr.sys) add_cd_file(TARGET setupldr FILE ${CMAKE_CURRENT_BINARY_DIR}/setupldr.sys DESTINATION loader NO_CAB FOR bootcd regtest) diff --git a/reactos/cmake/CMakeMacros.cmake b/reactos/cmake/CMakeMacros.cmake index 4b9291540f2..8a0bb4bc352 100644 --- a/reactos/cmake/CMakeMacros.cmake +++ b/reactos/cmake/CMakeMacros.cmake @@ -504,33 +504,12 @@ elseif(USE_FOLDER_STRUCTURE) endfunction() endif() -if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows") - macro(to_win_path _cmake_path _native_path) - string(REPLACE "/" "\\" ${_native_path} "${_cmake_path}") - endmacro() - - # yeah the parameter mess sucks, but thats what works... - function(concatenate_files _file1 _target2 _output) - get_target_property(_file2 ${_target2} LOCATION) - to_win_path("${_file1}" _real_file1) - to_win_path("${_file2}" _real_file2) - to_win_path("${_output}" _real_output) - add_custom_command( - OUTPUT ${_output} - COMMAND cmd.exe /C "copy /Y /B ${_real_file1} + ${_real_file2} ${_real_output} > nul" - DEPENDS ${_file1} - DEPENDS ${_target2}) - endfunction() -else() - macro(concatenate_files _file1 _target2 _output) - get_target_property(_file2 ${_target2} LOCATION) - add_custom_command( - OUTPUT ${_output} - COMMAND cat ${_file1} ${_file2} > ${_output} - DEPENDS ${_file1} - DEPENDS ${_target2}) - endmacro() -endif() +macro(concatenate_files _output) + add_custom_command( + OUTPUT ${_output} + COMMAND native-cat ${ARGN} > ${_output} + DEPENDS ${ARGN} native-cat) +endmacro() function(add_importlibs _module) add_dependency_node(${_module})