diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2019-05-22 12:16:31 -0700 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2019-05-27 01:24:08 +0300 |
commit | 0714ba58c7e3683156a258649e723518c0e2ddc7 (patch) | |
tree | fe9de4f0b6e78511e92d9b9a018ff9aa7ac9cbe6 /mesonbuild/dependencies | |
parent | 0d19d334a8b8e6ebbb1ebdaa5658790a01fdc466 (diff) | |
download | meson-0714ba58c7e3683156a258649e723518c0e2ddc7.zip meson-0714ba58c7e3683156a258649e723518c0e2ddc7.tar.gz meson-0714ba58c7e3683156a258649e723518c0e2ddc7.tar.bz2 |
coredata: add cmake_prefix_path option
Diffstat (limited to 'mesonbuild/dependencies')
-rw-r--r-- | mesonbuild/dependencies/base.py | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/mesonbuild/dependencies/base.py b/mesonbuild/dependencies/base.py index 37a8847..1ccbf6f 100644 --- a/mesonbuild/dependencies/base.py +++ b/mesonbuild/dependencies/base.py @@ -1129,11 +1129,19 @@ class CMakeDependency(ExternalDependency): modules = [(x, True) for x in stringlistify(extract_as_list(kwargs, 'modules'))] modules += [(x, False) for x in stringlistify(extract_as_list(kwargs, 'optional_modules'))] cm_path = stringlistify(extract_as_list(kwargs, 'cmake_module_path')) - cm_args = stringlistify(extract_as_list(kwargs, 'cmake_args')) cm_path = [x if os.path.isabs(x) else os.path.join(environment.get_source_dir(), x) for x in cm_path] + cm_args = stringlistify(extract_as_list(kwargs, 'cmake_args')) if cm_path: - cm_args += ['-DCMAKE_MODULE_PATH={}'.format(';'.join(cm_path))] - if not self._preliminary_find_check(name, cm_path, environment.machines[for_machine]): + cm_args.append('-DCMAKE_MODULE_PATH=' + ';'.join(cm_path)) + + if environment.is_cross_build() and self.want_cross: + pref_path = self.env.coredata.builtins['cross_cmake_prefix_path'].value + else: + pref_path = self.env.coredata.builtins['cmake_prefix_path'].value + if pref_path: + cm_args.append('-DCMAKE_PREFIX_PATH={}'.format(';'.join(pref_path))) + + if not self._preliminary_find_check(name, cm_path, pref_path, environment.machines[for_machine]): return self._detect_dep(name, modules, cm_args) @@ -1229,7 +1237,7 @@ class CMakeDependency(ExternalDependency): except OSError: return False - def _preliminary_find_check(self, name: str, module_path: List[str], machine: MachineInfo) -> bool: + def _preliminary_find_check(self, name: str, module_path: List[str], prefix_path: List[str], machine: MachineInfo) -> bool: lname = str(name).lower() # Checks <path>, <path>/cmake, <path>/CMake @@ -1273,6 +1281,12 @@ class CMakeDependency(ExternalDependency): if find_module(i): return True + # Check the user provided prefix paths + for i in prefix_path: + if search_lib_dirs(i): + return True + + # Check the system paths for i in self.cmakeinfo['module_paths']: if find_module(i): |