Updating DLL copy for cmake
MODIFY
examples/CMakeLists.txt
examples/CMakeLists.txt
@@ -32,7 +32,9 @@ function(add_thrust_example EXAMPLE)
PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/examples/"
)
- if (WIN32 AND NOT DLLS_COPIED)
+ if (WIN32 AND NOT DEFINED DLLS_COPIED)
+ set(DLLS_COPIED "YES")
+
# for now adding in all .dll as dependency chain is not cmake based on win32
file( GLOB third_party_dlls
LIST_DIRECTORIES ON
@@ -41,9 +43,8 @@ function(add_thrust_example EXAMPLE)
${CMAKE_SOURCE_DIR}/rtest.*
)
foreach( file_i ${third_party_dlls})
- add_custom_command( TARGET ${EXAMPLE_TARGET} POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy ${file_i} ${PROJECT_BINARY_DIR}/examples )
+ add_custom_command( TARGET ${EXAMPLE_TARGET} POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${file_i} ${PROJECT_BINARY_DIR}/examples )
endforeach( file_i )
- set(DLLS_COPIED ON)
endif()
endfunction()

MODIFY
test/CMakeLists.txt
test/CMakeLists.txt
@@ -26,10 +26,6 @@ configure_file(
${CMAKE_CURRENT_BINARY_DIR}/test_seed.hpp
)
-if (WIN32)
- set(DLLS_COPIED OFF)
-endif()
-
function(add_rocthrust_test TEST)
set(TEST_SOURCE "test_${TEST}.cpp")
set(TEST_TARGET "${TEST}.hip")
@@ -73,7 +69,9 @@ function(add_rocthrust_test TEST)
LABELS "hip"
)
endif()
- if (WIN32 AND NOT DLLS_COPIED)
+ if (WIN32 AND NOT DEFINED DLLS_COPIED)
+ set(DLLS_COPIED "YES")
+
# for now adding in all .dll as dependency chain is not cmake based on win32
file( GLOB third_party_dlls
LIST_DIRECTORIES ON
@@ -82,9 +80,8 @@ function(add_rocthrust_test TEST)
${CMAKE_SOURCE_DIR}/rtest.*
)
foreach( file_i ${third_party_dlls})
- add_custom_command( TARGET ${TEST_TARGET} POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy ${file_i} ${PROJECT_BINARY_DIR}/test )
+ add_custom_command( TARGET ${TEST_TARGET} POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${file_i} ${PROJECT_BINARY_DIR}/test )
endforeach( file_i )
- set(DLLS_COPIED ON)
endif()
endfunction()

Updating DLL copy for cmake