Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
vijaiaeroastro committed Jun 2, 2024
1 parent f3b19b2 commit 431b80a
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions cmake/lib3mfConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,19 @@ else()
# Define a custom function to handle library copying
function(copy_lib3mf_libraries target)
if(TARGET ${target})
if(APPLE)
# On macOS, copy .dylib files, preserving symlinks
add_custom_command(TARGET ${target} POST_BUILD
COMMAND sh -c "cp -P '${lib3mf_LIBRARY_DIR}/lib3mf.dylib'* '$<TARGET_FILE_DIR:${target}>' >/dev/null 2>&1 || true"
COMMENT "Copying all lib3mf library files to target directory on MacOS")
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 sh -c "for file in '${lib3mf_LIBRARY_DIR}/lib3mf.dylib'*; do \
target_file='$<TARGET_FILE_DIR:${target}/$(basename $file)'; \
if [ ! -f \"$target_file\" ]; then \
cp -P \"$file\" \"$target_file\"; \
fi; \
done"
COMMENT "Copying all lib3mf library files to target directory on MacOS")


elseif(UNIX)
elseif(UNIX)
# On Unix-like systems (excluding macOS), copy .so files, preserving symlinks
add_custom_command(TARGET ${target} POST_BUILD
COMMAND sh -c "cp -P '${lib3mf_LIBRARY_DIR}/lib3mf.so'* '$<TARGET_FILE_DIR:${target}>'"
Expand Down

0 comments on commit 431b80a

Please sign in to comment.