Thanks for the insight. Using the preconfigured install target "target" would indeed be sufficient for this small example.
Sadly, the real scenario is more complicated.
We have multiple applications (.exe files): the main app, the unit tests, and some prototypes or demo applications.
They should all use the same .dll.
So, it should be the application project that reaches out and fetches the .dll it needs and copies it to the proper location.
The dll project itself is not aware of the applications that use it, and should not copy the dll to multiple locations.
I've come up with a working solution using custom build targets:
utilDll.target = utilDll
utilDll.commands = $$OScopy($$BUILD_DIR/Util/$$CONFIGDIR/Util.dll ./$$CONFIGDIR/)
utilDll.depends = FORCE
QMAKE_EXTRA_TARGETS += utilDll
PRE_TARGETDEPS += utilDll
utilDll.target = utilDll
utilDll.commands = $$OScopy($$BUILD_DIR/Util/$$CONFIGDIR/Util.dll ./$$CONFIGDIR/)
utilDll.depends = FORCE
QMAKE_EXTRA_TARGETS += utilDll
PRE_TARGETDEPS += utilDll
To copy to clipboard, switch view to plain text mode
I guess INSTALLS only handles installation of the build target, or 3rd party libraries that were built before qmake is invoked.
One benifit from using custom build targets is: no need to run 'nmake install', or add this step to the build steps in QtCreator.
Bookmarks