Ask Your Question

Specify different Boost location in CMakeLists.txt

asked 2014-06-13 07:42:16 -0500

sanchises gravatar image

updated 2014-06-13 07:42:38 -0500


For a bunch of reasons (compatibility and functionality), I need to be able to specify a different location for the Boost headers.

So, instead of /usr/include, (default) I want rosmake to look FIRST in /my/example/path for inclusions of the style #include <boost/someheader.hpp> How can I do this???

Thanks a lot in advance!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2014-06-13 09:40:45 -0500

gvdhoorn gravatar image

From the documentation of FindBoost.cmake on the CMake site (you can also read this in the file itself):

This module reads hints about search locations from variables:

BOOST_ROOT                - Preferred installation prefix (or BOOSTROOT)
BOOST_INCLUDEDIR          - Preferred include directory e.g. <prefix>/include
BOOST_LIBRARYDIR          - Preferred library directory e.g. <prefix>/lib
Boost_NO_SYSTEM_PATHS     - Set to ON to disable searching in locations not
                            specified by these hint variables. Default is OFF.
Boost_ADDITIONAL_VERSIONS - List of Boost versions not known to this module
                            (Boost install locations may contain the version)

So additional Boost locations can be specified by setting the variable BOOST_ROOT variable. This can be done either in the CMakeLists.txt (be sure to check how this influences included / downstream build scripts) or from the command line using -DBOOST_ROOT=/some/path.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2014-06-13 07:42:16 -0500

Seen: 351 times

Last updated: Jun 13 '14