QMake: Automatically running a command after qmake generates Makefile
I'd like to run a shell command automatically after running qmake generating the Makefile. Is this possible? I checked documentation (only found @system()@ function, which is called before the Makefile is written) and Google did not come up with a suitable answer, either.
The reason why I ask is that the generated Makefiles automatically contain @-L/usr/lib/@ in the @LIBS@ variable (yes, i'm working with linux). Thereby I get an old version linked into my project, which is globally installed and since i'm not root, i cannot remove it.
My idea was to automatically change the makefile after running qmake and delete the entry in the LIBS variable with a command such as @sed -i 's/-L/usr/lib/ /g' Makefile@. If I do it manually, everything gets linked correctly.
Does anybody have an idea how to do this? Or another way to fix this problem? Resorting LD_LIBRARY_PATH or PKG_CONFIG_PATH does not have any effect. qmake seems to always puts this directory in first place an there seems to be no easy way to remove it.
Thank in advance!
try @QMAKE_PRE_LINK@ and @QMAKE_POST_LINK@
The problem with the both preceding answers is that the command modifying the Makefile gets evaluated when the Makefile is already being processed. It gets modified but the changes won't make effect, since the Makefile won't be read again before the linking process. The second answer works if I call make two times. It does not work the first time for the given reason.
Is there a way to execute the command by qmake after the Makefile has been generated?
Or perhaps is there a completely different way to get rid of this "-L/usr/lib" entry?
Nevertheless, thank you very much so far! :-)
I'm also looking for a way to run system() command after the creation of the makfile/vcproj.
I can't believe there is now way to achieve this!