Qt: Run a script BEFORE make

I have a script, runScript.sh, that I would like to have run (to setup some environment variables and such) BEFORE making the application.

Using advice from Running a program/script from QMake, in my .pro file, I have on the first line,

QMAKE_POST_LINK += ./runScript.sh

which will, on a make, compile and link my application and THEN run the script.

I've seen examples of how to set the script up as a target in the .pro file,but I am not sure if I quite grasp the concept. Could someone explain it better or (even better) does anyone know how to do what I'm trying to do simpler (I was hoping for a "QMAKE_PRE_LINK" but that does not seem to exist lol)?

Using Qt-4.8.4 & qmake 2.03


Link you've posted explains that 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, that 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


  • Need to display iframe when link is clicked from menu
  • Painting on JFrame without extending
  • In C. the name of an array is an pointer to it's first element, isn't it?
  • What does “+=” (plus equals) mean in Ruby? [closed]
  • Unable to get Emma Coverage for Android [duplicate]
  • Stack Cards horizontally with some offset
  • OleDBConnection Connection string
  • Comma within fields in CSV file -import to DB using SSIS
  • Linq to Sql Foreign key relationships
  • Syncronizing database from Active Directory
  • Additional scripts in PATH
  • Reading from Windows registry in Perl [duplicate]
  • Can't access Facebook campaigns
  • force json_encode to create strings
  • Merge Module leaving files during uninstall
  • Add the parent product name to each cart item names in WooCommerce
  • Magento get URL before current
  • Bigquery event streaming and table creation
  • NUnit 3.0 TestCase const custom object arguments
  • Updating both a ConcurrentHashMap and an AtomicInteger safely
  • Python pickle not one-to-one: different pickles give same object
  • SAVE attribute needed for Fortran variables when only the C_LOC address is returned to a C program?
  • Sonar maven jacoco code coverage for Multimodule project
  • Groovy: Unexpected token “:”
  • Webgrid not refreshing after delete MVC
  • Xcode 4 NSLog Macro link in Xcode 3
  • Jquery UI tool tip close icon
  • Read text file and split every line in MSBuild
  • Shallow update not allowed (git > 1.9)
  • Javascript + PHP Encryption with pidCrypt
  • Adding custom controls to a full screen movie
  • jquery mobile loadPage not working
  • Traverse Array and Display in markup
  • How to include full .NET prerequisite for Wix Burn installer
  • How to set the response of a form post action to a iframe source?
  • Change div Background jquery
  • File not found error Google Drive API
  • Qt: Run a script BEFORE make
  • reshape alternating columns in less time and using less memory
  • Conditional In-Line CSS for IE and Others?