--- CMakeLists.txt.orig	2018-08-03 22:10:42 UTC
+++ CMakeLists.txt
@@ -57,9 +57,9 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON)
 # "Helper" targets that don't have interesting source code should set their FOLDER property to this
 set(LOADER_HELPER_FOLDER "Helper Targets")
 
-if(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "Darwin")
+if(UNIX AND NOT APPLE)
     set(
-        FALLBACK_CONFIG_DIRS "/etc/xdg"
+        FALLBACK_CONFIG_DIRS "${CMAKE_INSTALL_PREFIX}/etc/xdg:/etc/xdg"
         CACHE
             STRING
             "Search path to use when XDG_CONFIG_DIRS is unset or empty or the current process is SUID/SGID. Default is freedesktop compliant."
@@ -72,7 +72,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_
         )
 endif()
 
-if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
+if(UNIX AND NOT APPLE)
     include(FindPkgConfig)
     option(BUILD_WSI_XCB_SUPPORT "Build XCB WSI support" ON)
     option(BUILD_WSI_XLIB_SUPPORT "Build Xlib WSI support" ON)
@@ -81,10 +81,12 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
 
     if(BUILD_WSI_XCB_SUPPORT)
         find_package(XCB REQUIRED)
+        include_directories(SYSTEM ${XCB_INCLUDE_DIR})
     endif()
 
     if(BUILD_WSI_XLIB_SUPPORT)
         find_package(X11 REQUIRED)
+        include_directories(SYSTEM ${X11_Xlib_INCLUDE_PATH})
     endif()
 
     if(BUILD_WSI_WAYLAND_SUPPORT)
