Issue
I'm currently working on a small CMake project with visual studio and I'm wanting to distribute my current build but I have no clue how to, when testing the app on another system it would error saying what I'm guessing were runtime dll's that were missing. I can't find anything online about it, and the official CMake tutorial didn't work for me. Does anyone know a way to do this?
Solution
Just like you have been told in the comments, the proper way to distribute an application on Windows is to use VC redistributable package. But if one wants to create an independent "bundle" CMake can help with it. It has a module which helps to bring the necessary dlls wherever needed. You need to understand and plan how your resulting bundle will look like and adapt the paths accordingly. I will just show you how to bring the dlls to the current binary directory with the help of the said module:
set(CMAKE_INSTALL_PREFIX "${CMAKE_CURRENT_BINARY_DIR}")
include(InstallRequiredSystemLibraries)
These 2 lines will make sure that you have an install target by building which the dlls required will be copied (installed) to the ${CMAKE_INSTALL_PREFIX}
path. That would be your start from which you can proceed further with any customization you need to make.
Answered By - ixSci Answer Checked By - David Goodson (WPSolving Volunteer)