diff --git a/cmake/Modules/LAMMPSUtils.cmake b/cmake/Modules/LAMMPSUtils.cmake index 9f624fc007..41e35a63a5 100644 --- a/cmake/Modules/LAMMPSUtils.cmake +++ b/cmake/Modules/LAMMPSUtils.cmake @@ -110,14 +110,15 @@ function(FetchPotentials pkgfolder potfolder) math(EXPR plusone "${blank}+1") string(SUBSTRING ${line} 0 ${blank} pot) string(SUBSTRING ${line} ${plusone} -1 sum) - if(EXISTS ${LAMMPS_POTENTIALS_DIR}/${pot}) + if(EXISTS "${LAMMPS_POTENTIALS_DIR}/${pot}") file(MD5 "${LAMMPS_POTENTIALS_DIR}/${pot}" oldsum) endif() if(NOT sum STREQUAL oldsum) - message(STATUS "Checking external potential ${pot} from ${LAMMPS_POTENTIALS_URL}") + message(STATUS "Downloading external potential ${pot} from ${LAMMPS_POTENTIALS_URL}") file(DOWNLOAD "${LAMMPS_POTENTIALS_URL}/${pot}.${sum}" "${CMAKE_BINARY_DIR}/${pot}" EXPECTED_HASH MD5=${sum} SHOW_PROGRESS) - file(COPY "${CMAKE_BINARY_DIR}/${pot}" DESTINATION ${LAMMPS_POTENTIALS_DIR}) + file(REMOVE "${LAMMPS_POTENTIALS_DIR}/${pot}") + file(COPY "${CMAKE_BINARY_DIR}/${pot}" DESTINATION "${LAMMPS_POTENTIALS_DIR}") endif() endforeach() endif()