Qt: Run the script BEFORE make

I have a script, runScript.sh, which I would like to run (to set up some environment variables, etc.) before creating the application.

Using the tip Launching a / script program from QMake , in my .pro file, I have the first line,

QMAKE_POST_LINK += ./runScript.sh 

which on make compiles and binds my application, and THEN runs the script.

I saw examples of how to set a script as a target in a .pro file, but I'm not sure if I fully understand the concept. Can someone explain this better or (even better) does anyone know how to make what I'm trying to do easier (I was hoping for "QMAKE_PRE_LINK", but that does not seem to exist LOL)?

Using Qt-4.8.4 and qmake 2.03

+2
source share
1 answer

The link you posted explains very well.

 extralib.target = extra extralib.commands = echo "Building extralib.."; \ # Run your programs here make -w -C ../my_libraries/extralib; \ echo "Done building extralib."; \ extralib.depends = QMAKE_EXTRA_TARGETS += extralib PRE_TARGETDEPS = extra 

So this could just be rewritten as

  extralib.target = extra extralib.commands = echo "Setuping the envirovment.."; \ export MYVAR="/usr/src/whatever" \ export SECONDVAR="/home/user" \ ./runScript.sh extralib.depends = QMAKE_EXTRA_TARGETS += extralib PRE_TARGETDEPS = extra 
+2
source

Source: https://habr.com/ru/post/978939/


All Articles