Search code examples
boostboost-buildbjamb2

boost-build / bjam: execute a script post install (make 'install' a dependency of executing a script)


Using boost-build / bjam, is it possible to execute a script after an install rule has completed?

I have a Jamfile which defined an executable (exe), and then installs it (install). I want to execute a script after the install step.

Jamfile:

exe my_app
  : [ glob *.cc ]
  : <link>static
  ;

install .
  : my_app 
  ;

{ execute script after install here }

I am aware that I can execute a script

[ SHELL "path/to/script.sh" ] ;

But I don't know how to have install be a dependency of the execution of that script?


Solution

  • You can probably use notfile target as described here. Although it is not explicitly stated there, notfile target also accepts a list of dependencies, so you can pass the install target as a source for notfile.

    import notfile ;
    
    install install-app : my_app : <location>. ;
    notfile . : @post-install : install-app ;
    actions post-install
    {
        echo Install is now done.
    }