simple install using bjam
I'm a boost.build newby and while bjam is quite easy to use for most compiling tasks and I didn't figured out how to do something that should be really simple : installing my application in the system.
Say I have a very simple project with two files in tree (besides Jamroot).
hello.cpp : a C++ program say it prints the content of /etc/hello.conf
hello.conf : a default hello.conf
What I want to do is:
- be able to to compile and link hello.cpp without installing anything system wide
- when called with an install target (and only then) :
- copy exe开发者_开发百科cutable hello to /usr/bin
- copy hello.conf to /etc.
Below is the bjam I started to write:
exe hello : hello.cpp ;
alias install : install-bin install-etc ;
install install-bin : hello : <location>/usr/bin ;
install install-etc : hello.conf : <location>/etc ;
My problem is that as a user I can't write to /etc nor /usr/bin and I want this to be done only when explicitely calling the install target, not everytime I type bjam.
It is quite important to me to separate the install and the building stages as building stage should be done using user rights and install stage using administrator rights.
What you wrote seems fine, except for two issues. First, the last line should read:
install install-etc : hello.conf : <location>/etc ;
explicit install install-bin install-etc ;
Second, the install
alias should refer to both install-bin
and install-etc
. When you make those changes, do things work?
精彩评论