From 32c41706e06e96ab10b757ebe6337071db53fe43 Mon Sep 17 00:00:00 2001 From: Alex Merry Date: Fri, 7 Nov 2014 12:26:48 +0000 Subject: Do not skip searching for X11 and Wayland on Windows While the search is unlikely to succeed on Windows, having different behaviour between the platforms (eg: find_package(Wayland REQUIRED) was not fatal on Windows, even though Wayland_FOUND would always be FALSE) is not ideal, and if someone did port them to Windows for some reason, the find modules should support that. If applications actually want different behaviour between platforms (like requiring a module on Unix, but not on Windows), they should implement that logic themselves (since they will have to deal with targets not being defined, etc, anyway). REVIEW: 120481 --- find-modules/FindX11_XCB.cmake | 82 ++++++++++++++++++++---------------------- 1 file changed, 38 insertions(+), 44 deletions(-) (limited to 'find-modules/FindX11_XCB.cmake') diff --git a/find-modules/FindX11_XCB.cmake b/find-modules/FindX11_XCB.cmake index 05d18d5a..eafa08e2 100644 --- a/find-modules/FindX11_XCB.cmake +++ b/find-modules/FindX11_XCB.cmake @@ -2,7 +2,7 @@ # FindX11_XCB # ----------- # -# Try to find the X11 XCB compatibility library on a Unix system +# Try to find the X11 XCB compatibility library. # # This will define the following variables: # @@ -68,55 +68,49 @@ if(CMAKE_MINIMUM_REQUIRED_VERSION VERSION_LESS 2.8.12) message(AUTHOR_WARNING "Your project should require at least CMake 2.8.12 to use FindX11_XCB.cmake") endif() -if(NOT WIN32) - # use pkg-config to get the directories and then use these values - # in the FIND_PATH() and FIND_LIBRARY() calls - find_package(PkgConfig) - pkg_check_modules(PKG_X11_XCB QUIET x11-xcb) +# use pkg-config to get the directories and then use these values +# in the FIND_PATH() and FIND_LIBRARY() calls +find_package(PkgConfig) +pkg_check_modules(PKG_X11_XCB QUIET x11-xcb) - set(X11_XCB_DEFINITIONS ${PKG_X11_XCB_CFLAGS_OTHER}) - set(X11_XCB_VERSION ${PKG_X11_XCB_VERSION}) +set(X11_XCB_DEFINITIONS ${PKG_X11_XCB_CFLAGS_OTHER}) +set(X11_XCB_VERSION ${PKG_X11_XCB_VERSION}) - find_path(X11_XCB_INCLUDE_DIR - NAMES X11/Xlib-xcb.h - HINTS ${PKG_X11_XCB_INCLUDE_DIRS} - ) - find_library(X11_XCB_LIBRARY - NAMES X11-xcb - HINTS ${PKG_X11_XCB_LIBRARY_DIRS} - ) - - include(FindPackageHandleStandardArgs) - find_package_handle_standard_args(X11_XCB - FOUND_VAR - X11_XCB_FOUND - REQUIRED_VARS - X11_XCB_LIBRARY - X11_XCB_INCLUDE_DIR - VERSION_VAR - X11_XCB_VERSION - ) +find_path(X11_XCB_INCLUDE_DIR + NAMES X11/Xlib-xcb.h + HINTS ${PKG_X11_XCB_INCLUDE_DIRS} +) +find_library(X11_XCB_LIBRARY + NAMES X11-xcb + HINTS ${PKG_X11_XCB_LIBRARY_DIRS} +) - if(X11_XCB_FOUND AND NOT TARGET X11::XCB) - add_library(X11::XCB UNKNOWN IMPORTED) - set_target_properties(X11::XCB PROPERTIES - IMPORTED_LOCATION "${X11_XCB_LIBRARY}" - INTERFACE_COMPILE_OPTIONS "${X11_XCB_DEFINITIONS}" - INTERFACE_INCLUDE_DIRECTORIES "${X11_XCB_INCLUDE_DIR}" - ) - endif() +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(X11_XCB + FOUND_VAR + X11_XCB_FOUND + REQUIRED_VARS + X11_XCB_LIBRARY + X11_XCB_INCLUDE_DIR + VERSION_VAR + X11_XCB_VERSION +) - mark_as_advanced(X11_XCB_INCLUDE_DIR X11_XCB_LIBRARY) +if(X11_XCB_FOUND AND NOT TARGET X11::XCB) + add_library(X11::XCB UNKNOWN IMPORTED) + set_target_properties(X11::XCB PROPERTIES + IMPORTED_LOCATION "${X11_XCB_LIBRARY}" + INTERFACE_COMPILE_OPTIONS "${X11_XCB_DEFINITIONS}" + INTERFACE_INCLUDE_DIRECTORIES "${X11_XCB_INCLUDE_DIR}" + ) +endif() - # compatibility variables - set(X11_XCB_LIBRARIES ${X11_XCB_LIBRARY}) - set(X11_XCB_INCLUDE_DIRS ${X11_XCB_INCLUDE_DIR}) - set(X11_XCB_VERSION_STRING ${X11_XCB_VERSION}) +mark_as_advanced(X11_XCB_INCLUDE_DIR X11_XCB_LIBRARY) -else() - message(STATUS "FindX11_XCB.cmake cannot find X11-XCB on Windows systems.") - set(X11_XCB_FOUND FALSE) -endif() +# compatibility variables +set(X11_XCB_LIBRARIES ${X11_XCB_LIBRARY}) +set(X11_XCB_INCLUDE_DIRS ${X11_XCB_INCLUDE_DIR}) +set(X11_XCB_VERSION_STRING ${X11_XCB_VERSION}) include(FeatureSummary) set_package_properties(X11_XCB PROPERTIES -- cgit v1.2.1