diff --git a/cmake/lib3mfConfig.cmake b/cmake/lib3mfConfig.cmake index d22c75b54..f1305b8f5 100644 --- a/cmake/lib3mfConfig.cmake +++ b/cmake/lib3mfConfig.cmake @@ -78,9 +78,12 @@ else() if(TARGET ${target}) if(APPLE) # On macOS, copy .dylib files, preserving symlinks only if they don't already exist in the target directory - add_custom_command(TARGET ${target} POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_if_different "${lib3mf_LIBRARY_DIR}/lib3mf.dylib" "$" - COMMENT "Copying lib3mf.dylib to target directory on macOS") + file(GLOB LIB3MF_FILES "${lib3mf_LIBRARY_DIR}/lib3mf.dylib*") + foreach(file ${LIB3MF_FILES}) + add_custom_command(TARGET ${target} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different "${file}" "$/$(basename ${file})" + COMMENT "Copying $(basename ${file}) to target directory on macOS if it is different") + endforeach() elseif(UNIX)