aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/dependencies/base.py
diff options
context:
space:
mode:
authorMarcin Niestroj <m.niestroj@grinn-global.com>2019-08-01 11:01:49 +0200
committerJussi Pakkanen <jpakkane@gmail.com>2019-08-03 02:35:00 +0300
commit987539e2331f2c78e94cbcf3623a82a66dd52267 (patch)
treeb7398ce230bf703a2f87018f2b942c239f468e6b /mesonbuild/dependencies/base.py
parentf39600647d9fe95c91c80b0cc7e7a8c28524e778 (diff)
downloadmeson-987539e2331f2c78e94cbcf3623a82a66dd52267.zip
meson-987539e2331f2c78e94cbcf3623a82a66dd52267.tar.gz
meson-987539e2331f2c78e94cbcf3623a82a66dd52267.tar.bz2
Improve support for crosscompiled CMake modules
There are two variables that CMake takes into account during find_package() in cross-compiled environments, which are: CMAKE_SYSROOT and CMAKE_FIND_ROOT_PATH. Those are used in cmFindCommon::RerootPaths() function, which blindly prepends all search paths with those specified via CMAKE_SYSROOT and CMAKE_FIND_ROOT_PATH. Extend search paths by using CMAKE_SYSROOT and CMAKE_FIND_ROOT_PATH in a similar way as CMake does, so we successfully find CMake packages information in cross-compiled environments.
Diffstat (limited to 'mesonbuild/dependencies/base.py')
-rw-r--r--mesonbuild/dependencies/base.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/mesonbuild/dependencies/base.py b/mesonbuild/dependencies/base.py
index 22f4c6f..0c325cc 100644
--- a/mesonbuild/dependencies/base.py
+++ b/mesonbuild/dependencies/base.py
@@ -1095,7 +1095,16 @@ class CMakeDependency(ExternalDependency):
return None
# Extract the variables and sanity check them
- module_paths = sorted(set(temp_parser.get_cmake_var('MESON_PATHS_LIST')))
+ root_paths = set(temp_parser.get_cmake_var('MESON_FIND_ROOT_PATH'))
+ root_paths.update(set(temp_parser.get_cmake_var('MESON_CMAKE_SYSROOT')))
+ root_paths = sorted(root_paths)
+ root_paths = list(filter(lambda x: os.path.isdir(x), root_paths))
+ module_paths = set(temp_parser.get_cmake_var('MESON_PATHS_LIST'))
+ rooted_paths = []
+ for j in [Path(x) for x in root_paths]:
+ for i in [Path(x) for x in module_paths]:
+ rooted_paths.append(str(j / i.relative_to(i.anchor)))
+ module_paths = sorted(module_paths.union(rooted_paths))
module_paths = list(filter(lambda x: os.path.isdir(x), module_paths))
archs = temp_parser.get_cmake_var('MESON_ARCH_LIST')