blob: 32b134dfb63f8d919f3017bbaf07c49361c4c1c3 [file] [log] [blame]
Anas Nashif3ae52622019-04-06 09:08:09 -04001# SPDX-License-Identifier: Apache-2.0
2
Carles Cufib8dd6ac2018-07-11 13:29:01 +02003# Merges a list of files into a destination file.
4# Usage: list of files as arguments, first argument is the destination file
5
6MATH(EXPR ARGC "${CMAKE_ARGC}-1")
7# First 3 arguments are "cmake", "-P", and "process.cmake"
8if( ${CMAKE_ARGC} LESS 5)
9 message(FATAL_ERROR "Not enough arguments")
10endif()
11
12set(DEST_FILE ${CMAKE_ARGV3})
13# Empty the file
14file(REMOVE ${DEST_FILE})
15
16foreach(i RANGE 4 ${ARGC})
Mark Ruvald Pedersen0efad5f2018-12-19 10:40:57 +010017 file(READ ${CMAKE_ARGV${i}} BUF)
18 file(APPEND ${DEST_FILE} ${BUF})
Carles Cufib8dd6ac2018-07-11 13:29:01 +020019endforeach()