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
0.54
Daniel Mensinger 5 years ago committed by Nirbheek Chauhan
parent 15b738841b
commit cf561b5cfc
  1. 13
      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()]

Loading…
Cancel
Save