diff --git a/cmake-tool/helpers/cpio.cmake b/cmake-tool/helpers/cpio.cmake index e85ac01d..b2a76016 100644 --- a/cmake-tool/helpers/cpio.cmake +++ b/cmake-tool/helpers/cpio.cmake @@ -44,9 +44,15 @@ function(MakeCPIO output_name input_files) set(archive_symbol ${MAKE_CPIO_CPIO_SYMBOL}) endif() + get_filename_component(cpio_lib_name "${output_name}" NAME) + get_filename_component(cpio_lib_dir "${output_name}" DIRECTORY) + if(NOT cpio_lib_dir) + set(cpio_lib_dir "${CMAKE_CURRENT_BINARY_DIR}") + endif() + # intermediate files - set(cpio_archive "archive.${output_name}.cpio") - set(cpio_archive_s "${output_name}.S") + set(cpio_archive "${cpio_lib_dir}/${cpio_lib_name}.cpio") + set(cpio_archive_s "${cpio_lib_dir}/${cpio_lib_name}.S") # Try to generate reproducible cpio archives using a command sequence that # runs in a separate shell in a temp folder. It creates an empty archive and @@ -59,10 +65,9 @@ function(MakeCPIO output_name input_files) CheckCPIOArgument(cpio_reproducible_flag "--reproducible") set( cpio_cmd - "cpio ${cpio_reproducible_flag} --quiet --create --format=newc --file=${CMAKE_CURRENT_BINARY_DIR}/${cpio_archive}" + "cpio ${cpio_reproducible_flag} --quiet --create --format=newc --file=${cpio_archive}" ) - - set(tmp_dir "temp_${output_name}") + set(tmp_dir "${cpio_lib_dir}/temp_${cpio_lib_name}") set(make_cpio "cd ${tmp_dir} && ${cpio_cmd}") foreach(file IN LISTS input_files) string(