From 4d53e30651c0fe5f7be38ae8529fa49846d39549 Mon Sep 17 00:00:00 2001 From: Lyude Paul Date: Mon, 23 Oct 2017 16:21:19 -0400 Subject: [PATCH] meson: Don't use '' in link_with, ever String arguments as elements in the array passed to the link_with argument in meson's executable() functions are not valid and will end up causing the build file generation to file. This actually ended up exposing a bug in meson that caused it not to report where in the meson.build file it was failing: https://github.com/mesonbuild/meson/pull/2527 The proper way to have a variable that can contain either an empty link target or an actual link target is: some_target = [] if some_cond some_target = static_library(...) endif This way if some_cond is False, some_target gets set to [], gets passed to executable() in the link_with array, and then gets removed by array flattening. This also unbreaks Xwayland builds with -Dglx=false, the thing that originally made me notice this. Signed-off-by: Lyude Paul Reviewed-by: Jon Turney --- glx/meson.build | 2 +- hw/dmx/meson.build | 2 +- meson.build | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/glx/meson.build b/glx/meson.build index a4af2b846..f13f8f24b 100644 --- a/glx/meson.build +++ b/glx/meson.build @@ -30,7 +30,7 @@ srcs_glx = [ 'xfont.c', ] -libxserver_glx = '' +libxserver_glx = [] if build_glx libxserver_glx = static_library('libxserver_glx', srcs_glx, diff --git a/hw/dmx/meson.build b/hw/dmx/meson.build index bc693c1c9..f2da0c27b 100644 --- a/hw/dmx/meson.build +++ b/hw/dmx/meson.build @@ -43,7 +43,7 @@ dmx_dep = [ dl_dep, ] -dmx_glx = '' +dmx_glx = [] if build_glx srcs += 'dmx_glxvisuals.c' subdir('glxProxy') diff --git a/meson.build b/meson.build index 2b63f0f19..6e7fc0664 100644 --- a/meson.build +++ b/meson.build @@ -214,7 +214,7 @@ if int10 == 'auto' endif endif -hal_dep = '' +hal_dep = [] if hal_option == 'auto' if not build_udev hal_dep = dependency('hal', required: false) @@ -264,7 +264,7 @@ endif # XXX: Add more sha1 options, because Linux is about choice sha1_dep = nettle_dep -xdmcp_dep = '' +xdmcp_dep = [] if get_option('xdmcp') xdmcp_dep = dependency('xdmcp') endif