aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
diff options
context:
space:
mode:
authorDaniel Mensinger <daniel@mensinger-ka.de>2019-07-16 18:00:36 +0200
committerJussi Pakkanen <jpakkane@gmail.com>2019-07-17 23:20:03 +0300
commit845f0e1133e27add934bef2863bd00858333f09b (patch)
treec44c67e1cb2af7b7800d79d150719a298408556c /mesonbuild
parent3b3f53ab55f3f232c195f070b36f433bb8c5c60c (diff)
downloadmeson-845f0e1133e27add934bef2863bd00858333f09b.zip
meson-845f0e1133e27add934bef2863bd00858333f09b.tar.gz
meson-845f0e1133e27add934bef2863bd00858333f09b.tar.bz2
cmake: Fix empty -D due to empty strings (closes #5522)
Diffstat (limited to 'mesonbuild')
-rw-r--r--mesonbuild/dependencies/base.py32
1 files changed, 15 insertions, 17 deletions
diff --git a/mesonbuild/dependencies/base.py b/mesonbuild/dependencies/base.py
index 8616367..76425f3 100644
--- a/mesonbuild/dependencies/base.py
+++ b/mesonbuild/dependencies/base.py
@@ -1290,9 +1290,9 @@ class CMakeDependency(ExternalDependency):
# Failed to guess a target --> try the old-style method
if len(modules) == 0:
- incDirs = self.traceparser.get_cmake_var('PACKAGE_INCLUDE_DIRS')
- defs = self.traceparser.get_cmake_var('PACKAGE_DEFINITIONS')
- libs = self.traceparser.get_cmake_var('PACKAGE_LIBRARIES')
+ incDirs = [x for x in self.traceparser.get_cmake_var('PACKAGE_INCLUDE_DIRS') if x]
+ defs = [x for x in self.traceparser.get_cmake_var('PACKAGE_DEFINITIONS') if x]
+ libs = [x for x in self.traceparser.get_cmake_var('PACKAGE_LIBRARIES') if x]
# Try to use old style variables if no module is specified
if len(libs) > 0:
@@ -1340,39 +1340,37 @@ class CMakeDependency(ExternalDependency):
mlog.debug(tgt)
if 'INTERFACE_INCLUDE_DIRECTORIES' in tgt.properies:
- incDirs += tgt.properies['INTERFACE_INCLUDE_DIRECTORIES']
+ incDirs += [x for x in tgt.properies['INTERFACE_INCLUDE_DIRECTORIES'] if x]
if 'INTERFACE_COMPILE_DEFINITIONS' in tgt.properies:
- tempDefs = list(tgt.properies['INTERFACE_COMPILE_DEFINITIONS'])
- tempDefs = list(map(lambda x: '-D{}'.format(re.sub('^-D', '', x)), tempDefs))
- compileDefinitions += tempDefs
+ compileDefinitions += ['-D' + re.sub('^-D', '', x) for x in tgt.properies['INTERFACE_COMPILE_DEFINITIONS'] if x]
if 'INTERFACE_COMPILE_OPTIONS' in tgt.properies:
- compileOptions += tgt.properies['INTERFACE_COMPILE_OPTIONS']
+ compileOptions += [x for x in tgt.properies['INTERFACE_COMPILE_OPTIONS'] if x]
if 'IMPORTED_CONFIGURATIONS' in tgt.properies:
- cfgs = tgt.properies['IMPORTED_CONFIGURATIONS']
+ cfgs = [x for x in tgt.properies['IMPORTED_CONFIGURATIONS'] if x]
cfg = cfgs[0]
if 'RELEASE' in cfgs:
cfg = 'RELEASE'
if 'IMPORTED_IMPLIB_{}'.format(cfg) in tgt.properies:
- libraries += tgt.properies['IMPORTED_IMPLIB_{}'.format(cfg)]
+ libraries += [x for x in tgt.properies['IMPORTED_IMPLIB_{}'.format(cfg)] if x]
elif 'IMPORTED_IMPLIB' in tgt.properies:
- libraries += tgt.properies['IMPORTED_IMPLIB']
+ libraries += [x for x in tgt.properies['IMPORTED_IMPLIB'] if x]
elif 'IMPORTED_LOCATION_{}'.format(cfg) in tgt.properies:
- libraries += tgt.properies['IMPORTED_LOCATION_{}'.format(cfg)]
+ libraries += [x for x in tgt.properies['IMPORTED_LOCATION_{}'.format(cfg)] if x]
elif 'IMPORTED_LOCATION' in tgt.properies:
- libraries += tgt.properies['IMPORTED_LOCATION']
+ libraries += [x for x in tgt.properies['IMPORTED_LOCATION'] if x]
if 'INTERFACE_LINK_LIBRARIES' in tgt.properies:
- otherDeps += tgt.properies['INTERFACE_LINK_LIBRARIES']
+ otherDeps += [x for x in tgt.properies['INTERFACE_LINK_LIBRARIES'] if x]
if 'IMPORTED_LINK_DEPENDENT_LIBRARIES_{}'.format(cfg) in tgt.properies:
- otherDeps += tgt.properies['IMPORTED_LINK_DEPENDENT_LIBRARIES_{}'.format(cfg)]
+ otherDeps += [x for x in tgt.properies['IMPORTED_LINK_DEPENDENT_LIBRARIES_{}'.format(cfg)] if x]
elif 'IMPORTED_LINK_DEPENDENT_LIBRARIES' in tgt.properies:
- otherDeps += tgt.properies['IMPORTED_LINK_DEPENDENT_LIBRARIES']
+ otherDeps += [x for x in tgt.properies['IMPORTED_LINK_DEPENDENT_LIBRARIES'] if x]
for j in otherDeps:
if j in self.traceparser.targets:
@@ -1391,7 +1389,7 @@ class CMakeDependency(ExternalDependency):
mlog.debug('Compiler Options: {}'.format(compileOptions))
mlog.debug('Libraries: {}'.format(libraries))
- self.compile_args = compileOptions + compileDefinitions + list(map(lambda x: '-I{}'.format(x), incDirs))
+ self.compile_args = compileOptions + compileDefinitions + ['-I{}'.format(x) for x in incDirs]
self.link_args = libraries
def _setup_cmake_dir(self, cmake_file: str) -> str: