How to copy dll files to the binary folder

Hey guys,
in order to get QT to work properly I have to copy the QT dlls to the binary folder on windows.
According to the docs ( this should be easily done via

However no files are copied to my binary folder. Am I missing something? Is this not the purpose of the install() function?

thanks for your help :slight_smile:

greets Julian

That command will not work for a build (unless you run the “INSTALL” command after every build). We used to copy all of the DLLs into the build directory but now we do this instead:


Configure Visual Studio runtime environment


set_target_properties(${PROJECT_NAME} PROPERTIES

thx for your answer.
I put your suggestion directly beneath add_executable()

 add_executable( ${APP_NAME} ${APP_SRC} )
  set(QT_ROOT "C:/Qt/5.15.8/msvc2019_64")
  set_target_properties(${APP_NAME} PROPERTIES
  VS_DEBUGGER_ENVIRONMENT "PATH=%PATH%;${QT_ROOT}/bin;${QT_ROOT}/plugins/platforms")

but this results in Qt5xxx.dll not found errors.
Am I using your snippet correctly?
I’m running newest CMake in VS 2022 with MSVC17

I did some digging. It does not seam to setting the property


has any effect

When I open the generated solution the debuger environment is still only set to path.

When I manually insert the Qt paths in the solution everything works fine.

=>so the question is why is this property not properly passed to the solution

You need to escape the path separators ; as they are treated as list separators in CMake. Try to use \\\; or if that does not help try \;. As you are using a merge environment you only need to define the additional parts of the path, i.e. set_target_properties(${APP_NAME} PROPERTIES VS_DEBUGGER_ENVIRONMENT "PATH=${QT_ROOT}/bin\\\;${QT_ROOT}/plugins/platforms")