From 37ece0e1bbe8a0019a63ac7e6462c36591c66a5b Mon Sep 17 00:00:00 2001 From: Zhou Wei <52485244+zhouwei25@users.noreply.github.com> Date: Thu, 27 May 2021 21:46:43 +0800 Subject: [PATCH] fix Ninja incremental compile bug of warpctc (#171) --- CMakeLists.txt | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 549a16e..cd8ccaa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -131,20 +131,9 @@ function(windows_symbolic TARGET) endif() # only copy the xx.cu to .xx.cu when the content are modified - set(copy_flag 1) - if (EXISTS ${final_path}/.${src}.cu) - file(READ ${final_path}/${src}.cpp SOURCE_STR) - file(READ ${final_path}/.${src}.cu TARGET_STR) - if (SOURCE_STR STREQUAL TARGET_STR) - set(copy_flag 0) - endif() - endif() - if (copy_flag) - add_custom_command(OUTPUT ${final_path}/.${src}.cu - COMMAND ${CMAKE_COMMAND} -E remove ${final_path}/.${src}.cu - COMMAND ${CMAKE_COMMAND} -E copy "${final_path}/${src}.cpp" "${final_path}/.${src}.cu" - COMMENT "create hidden file of ${src}.cu") - endif(copy_flag) + add_custom_command(OUTPUT ${final_path}/.${src}.cu + COMMAND ${CMAKE_COMMAND} -E copy_if_different "${final_path}/${src}.cpp" "${final_path}/.${src}.cu" + COMMENT "create hidden file of ${src}.cu") add_custom_target(${TARGET} ALL DEPENDS ${final_path}/.${src}.cu) endforeach() endfunction()