cmake: Allow overriding SYSCONFDIR for CMake build on unix.

This adds a new CMake option SYSCONFDIR. If SYSCONFDIR is specified then it will be used via the SYSCONFDIR define, and /etc will not be automatically added via EXTRASYSCONFDIR. If SYSCONFDIR is not specified then the old logic will be used (CMAKE_INSTALL_FULL_SYSCONFDIR added via SYSCONFDIR, and /etc, if it's not the same, added via EXTRASYSCONFDIR).
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9816a5a..07f3ab8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -90,6 +90,12 @@
             STRING
             "Search path to use when XDG_DATA_DIRS is unset or empty or the current process is SUID/SGID. Default is freedesktop compliant."
         )
+    set(
+        SYSCONFDIR ""
+        CACHE
+            STRING
+            "System-wide search directory. If not set or empty, CMAKE_INSTALL_FULL_SYSCONFDIR and /etc are used."
+        )
 endif()
 
 if(UNIX AND NOT APPLE) # i.e.: Linux
@@ -185,11 +191,17 @@
 if(UNIX)
     add_definitions(-DFALLBACK_CONFIG_DIRS="${FALLBACK_CONFIG_DIRS}")
     add_definitions(-DFALLBACK_DATA_DIRS="${FALLBACK_DATA_DIRS}")
-    add_definitions(-DSYSCONFDIR="${CMAKE_INSTALL_FULL_SYSCONFDIR}")
 
-    # Make sure /etc is searched by the loader
-    if(NOT (CMAKE_INSTALL_FULL_SYSCONFDIR STREQUAL "/etc"))
-        add_definitions(-DEXTRASYSCONFDIR="/etc")
+    if(NOT (SYSCONFDIR STREQUAL ""))
+        # SYSCONFDIR is specified, use it and do not force /etc.
+        add_definitions(-DSYSCONFDIR="${SYSCONFDIR}")
+    else()
+        add_definitions(-DSYSCONFDIR="${CMAKE_INSTALL_FULL_SYSCONFDIR}")
+
+        # Make sure /etc is searched by the loader
+        if(NOT (CMAKE_INSTALL_FULL_SYSCONFDIR STREQUAL "/etc"))
+            add_definitions(-DEXTRASYSCONFDIR="/etc")
+        endif()
     endif()
 endif()