I'm working on a game and a separate game engine(static library). The game copies includes and output from the game engine project via a pre-build script that I have set up in CMake.
When I'm changing code in the engine and want to test it; I run the game project. If the game project doesn't need recompiling though; the new lib files from the engine project will never be copied into the game project (I have set up pre-build events for copying before compiling the game project) and thus the changes wont take when I run the game.
This is annoying and has mislead me while debugging several times and I would therefore like the lib files to be copied every time the game project is started to ensure that they are always up to date.
I don't want to add a dependency from the engine project to the game project and therefore I cannot use a post-build script in the engine project to do this.
I have also looked into running a .bat file through the Debugging->Comand project setting in VS like they suggest here: How to run some script\excutable befure start debugging in VS2015?
This only works for release builds however since the debugger won't attach when starting through a .bat-file.
The batch code I've tried using for starting the generated .exe is:
start Absolute/Path/To/Generated/File.exe
call Absolute/Path/To/Generated/File.exe
Absolute/Path/To/Generated/File.exe
The only fully working solution that I have come up with is executing the script through the source code of my game project. I would like to do this outside the source though since I want to be able to copy my CMake to a new project and have all the problems already dealt with.
Edit: Since there seems to be some confusion about my use case I will explain it further. I want it to be possible to develop the game and the engine separate of each other and therefore, the game project repository has copies of the engine project's outputted libs. I can't solve the issue 100% by pointing to the engine project's output directory in the game project because of the possiblity of the following situation:
- Changes are made to the engine code and the project is recompiled.
- Changes are made to the game code and the project is recompiled (Script for copying lib files trigger).
- Changes are made to the engine code again and the project is recompiled.
- When testing the changes to the engine; the game project does not require a recompile (So no scripts trigger and no copying occurs) and it is run with the new lib files from the engine project's output directory to test the changes made in both projects.
- Everything works and the engine code is pushed to the engine repo and the game code is pushed to the game repo along with what the developer mistakenly thinks are the newest engine lib files.
- The game repo is now in a state where it doesn't run without access to the engine project.
TL;DR:
Can I somehow (through Visual Studio or CMake preferably) trigger a copy of a bunch of files every time a project is started through Visual Studio?