Install dlls on windows

Hello, new to C++ and cmake, so apologies if I’m missing something obvious…

I’m trying to build a small project that depends on two packages I downloaded from vcpkg, “gamma” and “qtbase”. I’m building from within VSCode with the cmake and c++ packages. I’m using vcpkg in manifest mode. I’m on windows and using the MSVC compiler. After I got done installing the projectt, I realized I also needed to put the dlls the executable depended on into the same folder as the executable. So I have this line where I copy the entire contents of the vcpkg bin folder: install(DIRECTORY "${VCPKG_PREFIX}/bin" DESTINATION "."). The executable really only needs about 1/4 of these dlls though. I’m wondering if there is a more elegant way to do this. I’ve included the following below: my CMakeLists.txt, my vcpkg manifest file, and the ad-hoc pkg-config file I wrote for gamma, which doesn’t come with a cmake config file.

Yes, I realize my first mistake was to try to do this on windows…

CMakeLists.txt:

cmake_minimum_required(VERSION 3.5)
cmake_policy(SET CMP0087 NEW)

project(Justly VERSION 0.1 LANGUAGES CXX)

set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)

set(VCPKG_PREFIX "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}")
set(CMAKE_INSTALL_PREFIX "${Justly_SOURCE_DIR}/install")
file(COPY_FILE "${Justly_SOURCE_DIR}/gamma.pc" "${VCPKG_PREFIX}/lib/pkgconfig/gamma.pc")

# without vulkan I get a warning that it wasn't found
# I don't think it actually gets used though
set(CMAKE_PREFIX_PATH "${VCPKG_PREFIX}" "C:/VulkanSDK/1.3.231.1")
set(VCPKG_BIN "${VCPKG_PREFIX}/bin")

add_executable(Justly
    [all the .cpp files]
)

find_package(PkgConfig REQUIRED)
find_package(Qt6 REQUIRED COMPONENTS Widgets)

pkg_check_modules(Justly REQUIRED gamma)

target_include_directories(Justly PUBLIC ${Justly_INCLUDE_DIRS})
target_compile_options(Justly PUBLIC ${Justly_CFLAGS})
target_link_libraries(Justly PUBLIC Qt6::Widgets ${Justly_LINK_LIBRARIES})

install(TARGETS Justly)
# this copies more than strictly necessary but I don't know how to do it better
install(DIRECTORY "${VCPKG_PREFIX}/bin" DESTINATION ".")

qt_generate_deploy_app_script(
    TARGET Justly
    FILENAME_VARIABLE deploy_script
)
install(SCRIPT ${deploy_script})

vcpkg.json:

{
  "name": "justly",
  "version-string": "0.1.0",
  "dependencies": [
    "gamma",
    "pkgconf",
    "qtbase"
  ]
}

gamma.pc:

prefix=C:/Users/brand/OneDrive/Desktop/Justly/build/vcpkg_installed/x64-windows
exec_prefix=${prefix}/bin
libdir=${prefix}/lib
includedir=${prefix}/include

Name: Gamma
Description: Generic Synthesis C++ Library
Version: gamma-2018-01-27
Requires: portaudio-2.0 sndfile
Libs: -L"${libdir}" -lgamma
Cflags: -I"${includedir}"