Skip to content

Commit 254a3f0

Browse files
committed
Avoid undeclared variable
If libxmlpp is a subproject, ahd the main project included a libxml2 wrap, then xml2_dep.type_name() is internal, but libxml2_lib is not set.
1 parent 708cecc commit 254a3f0

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

meson.build

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,10 @@ xml2_min_ver = '2.7.7'
106106
xml2_req = '>= @0@'.format(xml2_min_ver)
107107
xml2_dep = dependency('libxml-2.0', version: xml2_req, required: host_machine.system() != 'windows')
108108

109+
libxml2_lib_set = false
109110
if not xml2_dep.found()
110111
libxml2_lib = 'libxml2'
112+
libxml2_lib_set = true
111113
xml2_dep = cpp_compiler.find_library(libxml2_lib,
112114
has_headers: [
113115
'libxml/globals.h',
@@ -152,7 +154,9 @@ libxml2_lib_pkgconfig = ''
152154
if xml2_dep.type_name() == 'pkgconfig'
153155
xmlxx_requires += ['libxml-2.0', xml2_req]
154156
else
155-
libxml2_lib_pkgconfig = '-l@0@'.format(libxml2_lib)
157+
if libxml2_lib_set
158+
libxml2_lib_pkgconfig = '-l@0@'.format(libxml2_lib)
159+
endif
156160
endif
157161

158162
xmlxx_requires = ' '.join(xmlxx_requires)

0 commit comments

Comments
 (0)