meson: fix gpiod dependency

gpiod is not a "common" dependency, but only needed for specific
options.  Add it as a dependency only when necessary.

Name the dependency as `libgpiod_dep` to follow meson conventions.

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Ib650f5fe4e7085733f43eba608502e7e21a5c8db
diff --git a/bios/meson.build b/bios/meson.build
index 5515e2a..48136d6 100644
--- a/bios/meson.build
+++ b/bios/meson.build
@@ -14,7 +14,7 @@
         phosphor_logging_dep,
         pdi_dep,
         boost_dep,
-        libgpiod,
+        libgpiod_dep,
         libpldm_dep,
     ],
     link_with: [libpldmutil, software_common_lib],
diff --git a/eeprom-device/meson.build b/eeprom-device/meson.build
index 7dafd7b..a9e5b02 100644
--- a/eeprom-device/meson.build
+++ b/eeprom-device/meson.build
@@ -5,19 +5,13 @@
 
 eeprom_device_include = include_directories('.')
 
-libgpiod = dependency(
-    'libgpiodcxx',
-    default_options: ['bindings=cxx'],
-    version: '>=1.1.2',
-)
-
 executable(
     'phosphor-eepromdevice-software-update',
     'eeprom_device_software_manager.cpp',
     'eeprom_device.cpp',
     eeprom_device_version_src,
     include_directories: [common_include, eeprom_device_include],
-    dependencies: [sdbusplus_dep, phosphor_logging_dep, libgpiod],
+    dependencies: [sdbusplus_dep, phosphor_logging_dep, libgpiod_dep],
     link_with: [software_common_lib, libpldmutil],
     install: true,
     install_dir: get_option('libexecdir') / 'phosphor-code-mgmt',
diff --git a/meson.build b/meson.build
index 0bc6b7c..b00229d 100644
--- a/meson.build
+++ b/meson.build
@@ -69,23 +69,28 @@
 common_include = include_directories('.')
 
 common_build = build_tests.allowed() or get_option('bios-software-update').allowed() or get_option(
-    'i2cvr-software-update',
+    'cpld-software-update',
 ).allowed() or get_option(
     'eepromdevice-software-update',
 ).allowed() or get_option(
-    'cpld-software-update',
+    'i2cvr-software-update',
 ).allowed()
 
 if common_build
     libpldm_dep = dependency('libpldm')
+    subdir('common')
+endif
 
-    libgpiod = dependency(
+gpiod_needed = get_option('bios-software-update').allowed() or get_option(
+    'eepromdevice-software-update',
+).allowed()
+
+if gpiod_needed
+    libgpiod_dep = dependency(
         'libgpiodcxx',
         default_options: ['bindings=cxx'],
         version: '>=1.1.2',
     )
-
-    subdir('common')
 endif
 
 if get_option('bios-software-update').allowed()