开发者

simple install using bjam

开发者 https://www.devze.com 2022-12-09 14:47 出处:网络
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 syst

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) :

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?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号