From f29c5fae458d2159414c8a453dd598dccf3fb063 Mon Sep 17 00:00:00 2001 From: David Enberg Date: Fri, 11 Sep 2020 16:18:43 +0200 Subject: [PATCH] Change implementation of working directory --- Heaptrack.cmake | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Heaptrack.cmake b/Heaptrack.cmake index 0ed9702..4cea651 100644 --- a/Heaptrack.cmake +++ b/Heaptrack.cmake @@ -121,22 +121,22 @@ function(swift_add_heaptrack target) COMMAND $(MAKE) --directory=${heaptrack_BINARY_DIR} COMMENT "Heaptrack is running on ${target}\ (output: \"${report_directory}\")" COMMAND ${CMAKE_COMMAND} -E make_directory ${report_directory} - COMMAND ${heaptrack_BINARY_DIR}/bin/heaptrack $ ${x_PROGRAM_ARGS} - COMMAND mv ${working_directory}/heaptrack* ${report_directory} - WORKING_DIRECTORY ${working_directory} + COMMAND ${CMAKE_COMMAND} -E chdir ${working_directory} ${heaptrack_BINARY_DIR}/bin/heaptrack $ ${x_PROGRAM_ARGS} DEPENDS ${target} ) else() add_custom_target(${target_name} COMMENT "Heaptrack is running on ${target}\ (output: \"${report_directory}\")" COMMAND ${CMAKE_COMMAND} -E make_directory ${report_directory} - COMMAND ${Heaptrack_EXECUTABLE} $ ${x_PROGRAM_ARGS} - COMMAND mv ${working_directory}/heaptrack* ${report_directory} - WORKING_DIRECTORY ${working_directory} + COMMAND ${CMAKE_COMMAND} -E chdir ${working_directory} ${Heaptrack_EXECUTABLE} $ ${x_PROGRAM_ARGS} DEPENDS ${target} ) endif() + add_custom_command(TARGET ${target_name} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E rename ${working_directory}/heaptrack* ${report_directory}/${target_name}.gz + ) + if (NOT TARGET do-all-heaptrack) add_custom_target(do-all-heaptrack) endif()