Jonas
Jonas

Reputation: 501

Boost: Install headers only

How do I output all the boost headers to a path containing the boost version, without compiling anything or installing any already compiled libraries, in a platform-independent manner?

Upvotes: 5

Views: 6387

Answers (1)

Jonathan Wakely
Jonathan Wakely

Reputation: 171283

Why do you think you need to use b2 to do it?

If you don't want to build anything and just want to copy the headers then just copy the headers:

mkdir inc_dir
cp -R ./boost ./inc_dir/

If you want the headers in inc_dir/boost-1.59.0 then do that instead:

mkdir inc_dir/boost-1.59.0
cp -R ./boost ./inc_dir/boost-1.59.0/

If you don't want to have to name the directory yourself then get it from the boost/version.hpp header:

ver=`awk '/define.*BOOST_LIB_VERSION/ {print $3}' boost/version.hpp | sed 's/"//g'`
mkdir inc_dir/boost_${ver}_0/
cp -R ./boost ./inc_dir/boost_${ver}_0/

But this seems like a rather silly request now ... is it really something you need to do so often that extracting the version needs to be automated? How many versions of Boost do you install, where you don't start with a tarball such as boost_1_59_0.tar.bz2 that means you need to know the version anyway? I used to install multiple versions of Boost across multiple operating systems at previous jobs, and when starting the process never had a problem of not knowing which version of Boost I was working with.

Upvotes: 8

Related Questions