Always copy dependent dlls into exe directory

  • Thread starter Thread starter Admiral Habor
  • Start date Start date
A

Admiral Habor

Guest
Hi,

I have a CMake based C++ solution with mutliple projects. Some are shared libraries (dlls) some are executables in subfolders.

All libraries are build into the good old Build/bin folder.

All executables go into Build/Examples/*Name*/bin.

Nice and clean.

Each executable depends on some libraries of the solution and everything builds correctly upon each other the first time.

Of course I have to copy all dependent dlls into the executables bin folder via Post Build Commands so the exe always finds them even after installation/publication.


Problem:

If I only change something in a library's .cpp file and compile the executables do NOT rebuild, which is correct, since only the dll changes and not the libraries interface, but now the dll in the executable's bin folder is still the old version since the executable didn't rebuild and thus didn't rerun the Post Build Command.

The problem CAN be solved by explicitly rebuilding the executables project but its extremely annoying to always manually rebuilding the executables after building a library.

How do I make sure that always the newest dlls are copied to the executables build bin folder (from Build/bin to Build/Examples/*Name*/bin)?


Neither did I find a good CMake command nor a good Visual Studio setting for "always copy" yet.


Clancy 4ever

Continue reading...
 
Back
Top