outfile = 'libdnsdist_rust.a'
env = environment()
-env.append('CARGO', cargo.full_path())
-env.append('SYSCONFDIR', conf.get('SYSCONFDIR'))
-env.append('builddir', '.')
-env.append('generatedheadersdir', meson.current_build_dir() + '/..')
-env.append('srcdir', meson.current_source_dir())
-env.append('RUST_TARGET', '')
-env.append('RUSTC_TARGET_ARCH', '')
+env.set('_defaultCARGO', cargo.full_path())
+env.set('SYSCONFDIR', conf.get('SYSCONFDIR'))
+env.set('builddir', '.')
+env.set('generatedheadersdir', meson.current_build_dir() + '/..')
+env.set('srcdir', meson.current_source_dir())
+# The two calls below set the env var to an empty string if it does not exist already and leave it alone otherwise
+env.append('RUST_TARGET', '', separator: '')
+env.append('RUSTC_TARGET_ARCH', '', separator: '')
lib_dnsdist_rust = custom_target('libdnsdist_rust.a',
output: [outfile, 'cxx.h'],
env = environment()
-env.append('CARGO', cargo.full_path())
-env.append('SYSCONFDIR', conf.get('SYSCONFDIR').strip('"'))
-env.append('NODCACHEDIRNOD', conf.get('NODCACHEDIRNOD').strip('"'))
-env.append('NODCACHEDIRUDR', conf.get('NODCACHEDIRUDR').strip('"'))
-env.append('builddir', '.')
-env.append('srcdir', meson.current_source_dir())
-env.append('RUST_TARGET', '')
-env.append('RUSTC_TARGET_ARCH', '')
+env.set('_defaultCARGO', cargo.full_path())
+env.set('SYSCONFDIR', conf.get('SYSCONFDIR').strip('"'))
+env.set('NODCACHEDIRNOD', conf.get('NODCACHEDIRNOD').strip('"'))
+env.set('NODCACHEDIRUDR', conf.get('NODCACHEDIRUDR').strip('"'))
+env.set('builddir', '.')
+env.set('srcdir', meson.current_source_dir())
+# The two calls below set the env var to the empty string if it does not exist already and leave it alone otherwise
+env.append('RUST_TARGET', '', separator: '')
+env.append('RUSTC_TARGET_ARCH', '', separator: '')
lib_recrust = custom_target('librecrust.a',
output: [outfile, 'cxx.h', 'lib.rs.h', 'misc.rs.h', 'web.rs.h'],