diff --git a/cmake/build_helpers.cmake b/cmake/build_helpers.cmake index ad2f3b688..213d9fef8 100644 --- a/cmake/build_helpers.cmake +++ b/cmake/build_helpers.cmake @@ -678,9 +678,12 @@ function(generatePDBs) add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/${GENERATED_PDB}.pdb WORKING_DIRECTORY ${cv2pdb_SOURCE_DIR} COMMAND - (${CMAKE_COMMAND} -E remove -f ${CMAKE_BINARY_DIR}/${GENERATED_PDB}.pdb && - ${cv2pdb_SOURCE_DIR}/cv2pdb64.exe - $) || (exit 0) + ( + ${CMAKE_COMMAND} -E copy_if_different $ ${CMAKE_BINARY_DIR}/${GENERATED_PDB}.bak && + ${CMAKE_COMMAND} -E remove -f ${CMAKE_BINARY_DIR}/${GENERATED_PDB}.pdb && + ${cv2pdb_SOURCE_DIR}/cv2pdb64.exe ${CMAKE_BINARY_DIR}/${GENERATED_PDB}.bak && + ${CMAKE_COMMAND} -E remove -f ${CMAKE_BINARY_DIR}/${GENERATED_PDB}.bak + ) || (exit 0) DEPENDS $ COMMAND_EXPAND_LISTS)