Copying all linked shared objects with cpack

I am using Qt framework and I am trying to build a deb and tar.gz file using cpack. Everything seems to be working fine but the copied shard objects have full version numbers instead of just the major version. For example, when building the app, it links with libQt6Core.so.6 but the files that are copied is libQt6Core.so.6.7.0 (this probably because of the symbolic linking?)

This is what I am doing for copying

# removed above code for brevity

target_link_libraries(appScratchPad
        PRIVATE
        Qt6::Quick
        Qt6::Svg
        Qt6::QmlCompiler
        Qt6::Qml
        Qt6::Sql
        Qt6::WebEngineQuick
        ${MD_LIBRARY}
)

## CPack
# Get link libraries of the target
get_target_property(link_libraries appScratchPad LINK_LIBRARIES)

# Initialize the variable to store library paths
set(LIB_LOCATIONS "")

# Iterate over each link entry
foreach (lib IN LISTS link_libraries)
    # Check if the entry is a target and a library
    if (TARGET ${lib})
        # Obtain the full path to the library file
        get_target_property(lib_location ${lib} LOCATION)

        # Append the path to the LIB_LOCATIONS list
        if (lib_location)
            list(APPEND LIB_LOCATIONS ${lib_location})
            message(STATUS "Added ${lib_location} to LIB_LOCATIONS")
        else ()
            message(WARNING "Location for ${lib} not found.")
        endif ()
    else ()
        message(WARNING "Skipping ${lib} as it is not a target.")
    endif ()
endforeach ()

# Output the collected library locations
message(STATUS "LIB_LOCATIONS: ${LIB_LOCATIONS}")

set(CPACK_PACKAGE_NAME "ScratchPad")
set(CPACK_PACKAGE_VENDOR "Gollahalli")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "ScratchPad - A simple note taking app")
set(CPACK_PACKAGE_VERSION "${PROJECT_VERSION}")
set(CPACK_PACKAGE_VERSION_MAJOR "${PROJECT_VERSION_MAJOR}")
set(CPACK_PACKAGE_VERSION_MINOR "${PROJECT_VERSION_MINOR}")
set(CPACK_PACKAGE_VERSION_PATCH "${PROJECT_VERSION_PATCH}")
set(CPACK_PACKAGE_INSTALL_DIRECTORY "Gollahalli")
set(CPACK_PACKAGE_CONTACT "Akshay Raj Gollahalli <example@example.com>")
SET(CPACK_OUTPUT_FILE_PREFIX packages)

if (UNIX)
    set(CPACK_GENERATOR "TGZ;DEB")
elseif (WIN32)
    set(CPACK_GENERATOR "ZIP;NSIS")
endif ()
set(CPACK_COMPONENTS_ALL Runtime)

include(CPack)
include(InstallRequiredSystemLibraries)
include(GNUInstallDirs)
install(TARGETS appScratchPad
        BUNDLE DESTINATION .
        LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
        RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)

# Install Qt libraries
install(
        FILES
        ${LIB_LOCATIONS}
        DESTINATION
        ${CMAKE_INSTALL_LIBDIR}
        COMPONENT Runtime
)

How can I copy the right linked file? As in should I rename the files before copying or is there a setting I can add saying that link to the complete version number instead of symbolic links.

see install(RUNTIME_DEPENDENCY_SET appDeps) does nothing install? - Code - CMake Discourse