diff options
author | Daniel Mensinger <daniel@mensinger-ka.de> | 2020-05-22 14:59:00 +0200 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2020-05-22 17:08:02 +0300 |
commit | 2fd838d62dc16af0687b4be7da4ffb28cb6a9725 (patch) | |
tree | 0bb6496ef2acc69656d1c037d058c175845d4e5a /mesonbuild/dependencies/boost.py | |
parent | 5862ad6965c60caa861dfdcd29e499c34c4d00da (diff) | |
download | meson-2fd838d62dc16af0687b4be7da4ffb28cb6a9725.zip meson-2fd838d62dc16af0687b4be7da4ffb28cb6a9725.tar.gz meson-2fd838d62dc16af0687b4be7da4ffb28cb6a9725.tar.bz2 |
boost: Try extracting BOOST_ROOT from boost.pc
This is especially useful for Conan, where only the boost.pc
file is provided and manually setting BOOST_ROOT is not a
good solution since it is in a private cache directory.
See #5438
Diffstat (limited to 'mesonbuild/dependencies/boost.py')
-rw-r--r-- | mesonbuild/dependencies/boost.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/mesonbuild/dependencies/boost.py b/mesonbuild/dependencies/boost.py index 3849704..907c0c2 100644 --- a/mesonbuild/dependencies/boost.py +++ b/mesonbuild/dependencies/boost.py @@ -22,7 +22,7 @@ from .. import mlog from .. import mesonlib from ..environment import Environment -from .base import (DependencyException, ExternalDependency) +from .base import DependencyException, ExternalDependency, PkgConfigDependency from .misc import threads_factory # On windows 3 directory layouts are supported: @@ -605,6 +605,17 @@ class BoostDependency(ExternalDependency): roots += paths return roots # Do not add system paths if BOOST_ROOT is present + # Try getting the BOOST_ROOT from a boost.pc if it exists. This primarely + # allows BoostDependency to find boost from Conan. See #5438 + try: + boost_pc = PkgConfigDependency('boost', self.env, {'required': False}) + if boost_pc.found(): + boost_root = boost_pc.get_pkgconfig_variable('prefix', {'default': None}) + if boost_root: + roots += [Path(boost_root)] + except DependencyException: + pass + # Add roots from system paths inc_paths = [Path(x) for x in self.clib_compiler.get_default_include_dirs()] inc_paths = [x.parent for x in inc_paths if x.exists()] |