Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Boost: Install headers only

Tags:

c++

windows

boost

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?

like image 467
Jonas Avatar asked Aug 24 '15 18:08

Jonas


1 Answers

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.

like image 200
Jonathan Wakely Avatar answered Sep 29 '22 22:09

Jonathan Wakely