diff -urN hdf5-1.10.0-patch1.orig/hl/tools/h5watch/CMakeTests.cmake hdf5-1.10.0-patch1/hl/tools/h5watch/CMakeTests.cmake
--- hdf5-1.10.0-patch1.orig/hl/tools/h5watch/CMakeTests.cmake	2016-05-02 16:56:10.000000000 +0000
+++ hdf5-1.10.0-patch1/hl/tools/h5watch/CMakeTests.cmake	2016-06-08 09:42:17.739503700 +0000
@@ -45,18 +45,22 @@
 
 # make test dir
 file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles")
-add_custom_target(h5watch-files ALL COMMENT "Copying files needed by h5watch tests")
 
 foreach (h5watch_file ${H5WATCH_TEST_FILES})
+  set (src "${HDF5_HL_TOOLS_DIR}/testfiles/${h5watch_file}")
   set (dest "${PROJECT_BINARY_DIR}/testfiles/${h5watch_file}")
   #message (STATUS " Copying ${h5watch_file}")
   add_custom_command (
-      TARGET     h5watch-files
-      POST_BUILD
-      COMMAND    ${CMAKE_COMMAND}
-      ARGS       -E copy_if_different ${HDF5_HL_TOOLS_DIR}/testfiles/${h5watch_file} ${dest}
+      OUTPUT  "${dest}"
+      COMMAND "${CMAKE_COMMAND}"
+      ARGS    -E copy "${src}" "${dest}"
+      DEPENDS "${src}"
   )
-endforeach (h5watch_file ${H5WATCH_TEST_FILES})
+  list(APPEND H5WATCH_BINARY_TEST_FILES "${dest}")
+endforeach ()
+
+add_custom_target(h5watch-files ALL COMMENT "Copying files needed by h5watch tests"
+                  DEPENDS ${H5WATCH_BINARY_TEST_FILES})
 
 ##############################################################################
 ##############################################################################
diff -urN hdf5-1.10.0-patch1.orig/tools/h5format_convert/CMakeTests.cmake hdf5-1.10.0-patch1/tools/h5format_convert/CMakeTests.cmake
--- hdf5-1.10.0-patch1.orig/tools/h5format_convert/CMakeTests.cmake	2016-05-02 16:56:08.000000000 +0000
+++ hdf5-1.10.0-patch1/tools/h5format_convert/CMakeTests.cmake	2016-06-08 09:04:46.185991800 +0000
@@ -58,30 +58,36 @@
   )
 
   file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles")
-  add_custom_target(h5fc-files ALL COMMENT "Copying files needed by h5fc tests")
 
   foreach (ddl_file ${HDF5_REFERENCE_FILES})
+    set (ddlsrc "${HDF5_TOOLS_H5FC_SOURCE_DIR}/testfiles/${ddl_file}")
     set (ddldest "${PROJECT_BINARY_DIR}/testfiles/${ddl_file}")
     #message (STATUS " Translating ${ddl_file}")
     add_custom_command (
-        TARGET     h5fc-files
-        POST_BUILD
-        COMMAND    ${CMAKE_COMMAND}
-        ARGS       -E copy_if_different ${HDF5_TOOLS_H5FC_SOURCE_DIR}/testfiles/${ddl_file} ${ddldest}
+        OUTPUT  "${ddldest}"
+        COMMAND "${CMAKE_COMMAND}"
+        ARGS    -E copy_if_different "${ddlsrc}" "${ddldest}"
+        DEPENDS "${ddlsrc}"
     )
-  endforeach (ddl_file ${HDF5_REFERENCE_FILES})
+    list(APPEND HDF5_BINARY_REFERENCE_FILES "${ddldest}")
+  endforeach ()
 
   foreach (h5_file ${HDF5_REFERENCE_TEST_FILES})
+    set (src "${HDF5_TOOLS_H5FC_SOURCE_DIR}/testfiles/${h5_file}")
     set (dest "${PROJECT_BINARY_DIR}/testfiles/${h5_file}")
     #message (STATUS " Copying ${h5_file}")
     add_custom_command (
-        TARGET     h5fc-files
-        POST_BUILD
-        COMMAND    ${CMAKE_COMMAND}
-        ARGS       -E copy_if_different ${HDF5_TOOLS_H5FC_SOURCE_DIR}/testfiles/${h5_file} ${dest}
+        OUTPUT  "${dest}"
+        COMMAND "${CMAKE_COMMAND}"
+        ARGS    -E copy_if_different "${src}" "${dest}"
+        DEPENDS "${src}"
     )
+    list(APPEND HDF5_BINARY_REFERENCE_TEST_FILES "${dest}")
   endforeach (h5_file ${HDF5_REFERENCE_TEST_FILES})
 
+  add_custom_target(h5fc-files ALL COMMENT "Copying files needed by h5fc tests"
+                    DEPENDS ${HDF5_BINARY_REFERENCE_FILES} ${HDF5_BINARY_REFERENCE_TEST_FILES})
+
 ##############################################################################
 ##############################################################################
 ###           T H E   T E S T S  M A C R O S                               ###
diff -urN hdf5-1.10.0-patch1.orig/tools/perform/CMakeTests.cmake hdf5-1.10.0-patch1/tools/perform/CMakeTests.cmake
--- hdf5-1.10.0-patch1.orig/tools/perform/CMakeTests.cmake	2016-03-28 16:26:44.000000000 +0000
+++ hdf5-1.10.0-patch1/tools/perform/CMakeTests.cmake	2016-06-08 09:42:07.819495800 +0000
@@ -5,11 +5,14 @@
 ##############################################################################
 ##############################################################################
 
-add_custom_command (
-    TARGET     zip_perf
-    POST_BUILD
-    COMMAND    ${CMAKE_COMMAND}
-    ARGS       -E copy_if_different ${HDF5_TOOLS_SRC_DIR}/testfiles/tfilters.h5 ${PROJECT_BINARY_DIR}/tfilters.h5
+add_custom_command(
+    OUTPUT "${PROJECT_BINARY_DIR}/tfilters.h5"
+    COMMAND "${CMAKE_COMMAND}" -E copy "${HDF5_TOOLS_SRC_DIR}/testfiles/tfilters.h5" "${PROJECT_BINARY_DIR}/tfilters.h5"
+    DEPENDS "${HDF5_TOOLS_SRC_DIR}/testfiles/tfilters.h5"
+)
+
+add_custom_target(zip_perf_file ALL COMMENT "Copying files needed by perform tests"
+    DEPENDS "${PROJECT_BINARY_DIR}/tfilters.h5"
 )
 
 #-----------------------------------------------------------------------------
