aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2020-04-17 18:19:44 +0300
committerGitHub <noreply@github.com>2020-04-17 18:19:44 +0300
commit1100484148163af4ea9c9515de763082494ea12f (patch)
tree7aeebfc3bd1fbc1c78d40122ca4dd2cc963764aa
parent3103b336a64b1d2d56237bbffc7a0b4e3ebdc571 (diff)
parentf5f3805ce24d726feea1544ec9ad9fd1b9342c9b (diff)
downloadmeson-1100484148163af4ea9c9515de763082494ea12f.zip
meson-1100484148163af4ea9c9515de763082494ea12f.tar.gz
meson-1100484148163af4ea9c9515de763082494ea12f.tar.bz2
Merge pull request #6980 from fooishbar/cmake-windows-system-lib-deps
Fix CMake Windows system library deps
-rw-r--r--mesonbuild/dependencies/base.py18
1 files changed, 16 insertions, 2 deletions
diff --git a/mesonbuild/dependencies/base.py b/mesonbuild/dependencies/base.py
index 50f4179..8b452cd 100644
--- a/mesonbuild/dependencies/base.py
+++ b/mesonbuild/dependencies/base.py
@@ -1411,7 +1411,9 @@ class CMakeDependency(ExternalDependency):
'Valid targets are:\n{}'.format(name, list(self.traceparser.targets.keys())))
# Set dependencies with CMake targets
- reg_is_lib = re.compile(r'^(-l[a-zA-Z0-9_]+|-pthread)$')
+ # recognise arguments we should pass directly to the linker
+ reg_is_lib = re.compile(r'^(-l[a-zA-Z0-9_]+|-pthread|-delayload:[a-zA-Z0-9_\.]+|[a-zA-Z0-9_]+\.lib)$')
+ reg_is_maybe_bare_lib = re.compile(r'^[a-zA-Z0-9_]+$')
processed_targets = []
incDirs = []
compileDefinitions = []
@@ -1479,8 +1481,20 @@ class CMakeDependency(ExternalDependency):
for j in otherDeps:
if j in self.traceparser.targets:
targets += [j]
- elif reg_is_lib.match(j) or os.path.exists(j):
+ elif reg_is_lib.match(j):
libraries += [j]
+ elif os.path.isabs(j) and os.path.exists(j):
+ libraries += [j]
+ elif mesonlib.is_windows() and reg_is_maybe_bare_lib.match(j):
+ # On Windows, CMake library dependencies can be passed as bare library names,
+ # e.g. 'version' should translate into 'version.lib'. CMake brute-forces a
+ # combination of prefix/suffix combinations to find the right library, however
+ # as we do not have a compiler environment available to us, we cannot do the
+ # same, but must assume any bare argument passed which is not also a CMake
+ # target must be a system library we should try to link against
+ libraries += ["{}.lib".format(j)]
+ else:
+ mlog.warning('CMake: Dependency', mlog.bold(j), 'for', mlog.bold(name), 'target', mlog.bold(self._original_module_name(curr)), 'was not found')
processed_targets += [curr]