diff options
| -rw-r--r-- | find-modules/FindEGL.cmake | 146 | ||||
| -rw-r--r-- | find-modules/FindQtWaylandScanner.cmake | 37 | ||||
| -rw-r--r-- | find-modules/FindWayland.cmake | 110 | ||||
| -rw-r--r-- | find-modules/FindWaylandScanner.cmake | 37 | ||||
| -rw-r--r-- | find-modules/FindX11_XCB.cmake | 82 | ||||
| -rw-r--r-- | find-modules/FindXCB.cmake | 187 | 
6 files changed, 283 insertions, 316 deletions
| diff --git a/find-modules/FindEGL.cmake b/find-modules/FindEGL.cmake index f1962b9a..99d268df 100644 --- a/find-modules/FindEGL.cmake +++ b/find-modules/FindEGL.cmake @@ -2,7 +2,7 @@  # FindEGL  # -------  # -# Try to find EGL on a Unix system. +# Try to find EGL.  #  # This will define the following variables:  # @@ -65,90 +65,84 @@ 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 FindEGL.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_EGL QUIET egl) +# 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_EGL QUIET egl) -    set(EGL_DEFINITIONS ${PKG_EGL_CFLAGS_OTHER}) +set(EGL_DEFINITIONS ${PKG_EGL_CFLAGS_OTHER}) -    find_path(EGL_INCLUDE_DIR -        NAMES -            egl.h -        HINTS -            ${PKG_EGL_INCLUDE_DIRS} -        PATH_SUFFIXES -            EGL -    ) -    find_library(EGL_LIBRARY -        NAMES -            EGL -        HINTS -            ${PKG_EGL_LIBRARY_DIRS} -    ) - -    # NB: We do *not* use the version information from pkg-config, as that -    #     is the implementation version (eg: the Mesa version) -    if(EGL_INCLUDE_DIR) -        # egl.h has defines of the form EGL_VERSION_x_y for each supported -        # version; so the header for EGL 1.1 will define EGL_VERSION_1_0 and -        # EGL_VERSION_1_1.  Finding the highest supported version involves -        # finding all these defines and selecting the highest numbered. -        file(READ "${EGL_INCLUDE_DIR}/egl.h" _EGL_header_contents) -        string(REGEX MATCHALL -            "[ \\t]EGL_VERSION_[0-9_]+" -            _EGL_version_lines -            "${_EGL_header_contents}" -        ) -        unset(_EGL_header_contents) -        foreach(_EGL_version_line ${_EGL_version_lines}) -            string(REGEX REPLACE -                "[ \\t]EGL_VERSION_([0-9_]+)" -                "\\1" -                _version_candidate -                "${_EGL_version_line}" -            ) -            string(REPLACE "_" "." _version_candidate "${_version_candidate}") -            if(NOT DEFINED EGL_VERSION OR EGL_VERSION VERSION_LESS _version_candidate) -                set(EGL_VERSION "${_version_candidate}") -            endif() -        endforeach() -        unset(_EGL_version_lines) -    endif() +find_path(EGL_INCLUDE_DIR +    NAMES +        egl.h +    HINTS +        ${PKG_EGL_INCLUDE_DIRS} +    PATH_SUFFIXES +        EGL +) +find_library(EGL_LIBRARY +    NAMES +        EGL +    HINTS +        ${PKG_EGL_LIBRARY_DIRS} +) -    include(FindPackageHandleStandardArgs) -    find_package_handle_standard_args(EGL -        FOUND_VAR -            EGL_FOUND -        REQUIRED_VARS -            EGL_LIBRARY -            EGL_INCLUDE_DIR -        VERSION_VAR -            EGL_VERSION +# NB: We do *not* use the version information from pkg-config, as that +#     is the implementation version (eg: the Mesa version) +if(EGL_INCLUDE_DIR) +    # egl.h has defines of the form EGL_VERSION_x_y for each supported +    # version; so the header for EGL 1.1 will define EGL_VERSION_1_0 and +    # EGL_VERSION_1_1.  Finding the highest supported version involves +    # finding all these defines and selecting the highest numbered. +    file(READ "${EGL_INCLUDE_DIR}/egl.h" _EGL_header_contents) +    string(REGEX MATCHALL +        "[ \\t]EGL_VERSION_[0-9_]+" +        _EGL_version_lines +        "${_EGL_header_contents}"      ) - -    if(EGL_FOUND AND NOT TARGET EGL::EGL) -        add_library(EGL::EGL UNKNOWN IMPORTED) -        set_target_properties(EGL::EGL PROPERTIES -            IMPORTED_LOCATION "${EGL_LIBRARY}" -            INTERFACE_COMPILE_OPTIONS "${EGL_DEFINITIONS}" -            INTERFACE_INCLUDE_DIRECTORIES "${EGL_INCLUDE_DIR}" +    unset(_EGL_header_contents) +    foreach(_EGL_version_line ${_EGL_version_lines}) +        string(REGEX REPLACE +            "[ \\t]EGL_VERSION_([0-9_]+)" +            "\\1" +            _version_candidate +            "${_EGL_version_line}"          ) -    endif() - -    mark_as_advanced(EGL_LIBRARY EGL_INCLUDE_DIR) +        string(REPLACE "_" "." _version_candidate "${_version_candidate}") +        if(NOT DEFINED EGL_VERSION OR EGL_VERSION VERSION_LESS _version_candidate) +            set(EGL_VERSION "${_version_candidate}") +        endif() +    endforeach() +    unset(_EGL_version_lines) +endif() -    # compatibility variables -    set(EGL_LIBRARIES ${EGL_LIBRARY}) -    set(EGL_INCLUDE_DIRS ${EGL_INCLUDE_DIR}) -    set(EGL_VERSION_STRING ${EGL_VERSION}) +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(EGL +    FOUND_VAR +        EGL_FOUND +    REQUIRED_VARS +        EGL_LIBRARY +        EGL_INCLUDE_DIR +    VERSION_VAR +        EGL_VERSION +) -else() -    message(STATUS "FindEGL.cmake cannot find EGL on Windows systems. Try finding WGL instead.") -    set(EGL_FOUND FALSE) +if(EGL_FOUND AND NOT TARGET EGL::EGL) +    add_library(EGL::EGL UNKNOWN IMPORTED) +    set_target_properties(EGL::EGL PROPERTIES +        IMPORTED_LOCATION "${EGL_LIBRARY}" +        INTERFACE_COMPILE_OPTIONS "${EGL_DEFINITIONS}" +        INTERFACE_INCLUDE_DIRECTORIES "${EGL_INCLUDE_DIR}" +    )  endif() +mark_as_advanced(EGL_LIBRARY EGL_INCLUDE_DIR) + +# compatibility variables +set(EGL_LIBRARIES ${EGL_LIBRARY}) +set(EGL_INCLUDE_DIRS ${EGL_INCLUDE_DIR}) +set(EGL_VERSION_STRING ${EGL_VERSION}) +  include(FeatureSummary)  set_package_properties(EGL PROPERTIES      URL "https://www.khronos.org/egl/" diff --git a/find-modules/FindQtWaylandScanner.cmake b/find-modules/FindQtWaylandScanner.cmake index acd7e0b2..7fb8a009 100644 --- a/find-modules/FindQtWaylandScanner.cmake +++ b/find-modules/FindQtWaylandScanner.cmake @@ -2,7 +2,7 @@  # FindQtWaylandScanner  # --------------------  # -# Try to find qtwaylandscanner on a Unix system. +# Try to find qtwaylandscanner.  #  # If the qtwaylandscanner executable is not in your PATH, you can provide  # an alternative name or full path location with the ``QtWaylandScanner_EXECUTABLE`` @@ -87,29 +87,24 @@ include(${CMAKE_CURRENT_LIST_DIR}/ECMFindModuleHelpersStub.cmake)  ecm_find_package_version_check(QtWaylandScanner) -if(NOT WIN32) -    # Find qtwaylandscanner -    find_program(QtWaylandScanner_EXECUTABLE NAMES qtwaylandscanner) +# Find qtwaylandscanner +find_program(QtWaylandScanner_EXECUTABLE NAMES qtwaylandscanner) -    include(FindPackageHandleStandardArgs) -    find_package_handle_standard_args(QtWaylandScanner -        FOUND_VAR -            QtWaylandScanner_FOUND -        REQUIRED_VARS -            QtWaylandScanner_EXECUTABLE -    ) +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(QtWaylandScanner +    FOUND_VAR +        QtWaylandScanner_FOUND +    REQUIRED_VARS +        QtWaylandScanner_EXECUTABLE +) -    mark_as_advanced(QtWaylandScanner_EXECUTABLE) +mark_as_advanced(QtWaylandScanner_EXECUTABLE) -    if(NOT TARGET Wayland::QtScanner AND QtWaylandScanner_FOUND) -        add_executable(Wayland::QtScanner IMPORTED) -        set_target_properties(Wayland::QtScanner PROPERTIES -            IMPORTED_LOCATION "${QtWaylandScanner_EXECUTABLE}" -        ) -    endif() -else() -    message(STATUS "Wayland and QtWayland are not available on Windows.") -    set(QtWaylandScanner_FOUND FALSE) +if(NOT TARGET Wayland::QtScanner AND QtWaylandScanner_FOUND) +    add_executable(Wayland::QtScanner IMPORTED) +    set_target_properties(Wayland::QtScanner PROPERTIES +        IMPORTED_LOCATION "${QtWaylandScanner_EXECUTABLE}" +    )  endif()  include(FeatureSummary) diff --git a/find-modules/FindWayland.cmake b/find-modules/FindWayland.cmake index 11716f04..490ab1be 100644 --- a/find-modules/FindWayland.cmake +++ b/find-modules/FindWayland.cmake @@ -2,7 +2,7 @@  # FindWayland  # -----------  # -# Try to find Wayland on a Unix system. +# Try to find Wayland.  #  # This is a component-based find module, which makes use of the COMPONENTS  # and OPTIONAL_COMPONENTS arguments to find_module.  The following components @@ -77,69 +77,63 @@ include(${CMAKE_CURRENT_LIST_DIR}/ECMFindModuleHelpersStub.cmake)  ecm_find_package_version_check(Wayland) -if(NOT WIN32) -    set(Wayland_known_components -        Client -        Server -        Cursor -        Egl -    ) -    foreach(_comp ${Wayland_known_components}) -        string(TOLOWER "${_comp}" _lc_comp) -        set(Wayland_${_comp}_component_deps) -        set(Wayland_${_comp}_pkg_config "wayland-${_lc_comp}") -        set(Wayland_${_comp}_lib "wayland-${_lc_comp}") -        set(Wayland_${_comp}_header "wayland-${_lc_comp}.h") -    endforeach() -    set(Wayland_Egl_component_deps Client) +set(Wayland_known_components +    Client +    Server +    Cursor +    Egl +) +foreach(_comp ${Wayland_known_components}) +    string(TOLOWER "${_comp}" _lc_comp) +    set(Wayland_${_comp}_component_deps) +    set(Wayland_${_comp}_pkg_config "wayland-${_lc_comp}") +    set(Wayland_${_comp}_lib "wayland-${_lc_comp}") +    set(Wayland_${_comp}_header "wayland-${_lc_comp}.h") +endforeach() +set(Wayland_Egl_component_deps Client) -    ecm_find_package_parse_components(Wayland -        RESULT_VAR Wayland_components -        KNOWN_COMPONENTS ${Wayland_known_components} -    ) -    ecm_find_package_handle_library_components(Wayland -        COMPONENTS ${Wayland_components} -    ) +ecm_find_package_parse_components(Wayland +    RESULT_VAR Wayland_components +    KNOWN_COMPONENTS ${Wayland_known_components} +) +ecm_find_package_handle_library_components(Wayland +    COMPONENTS ${Wayland_components} +) -    # If pkg-config didn't provide us with version information, -    # try to extract it from wayland-version.h -    # (Note that the version from wayland-egl.pc will probably be -    # the Mesa version, rather than the Wayland version, but that -    # version will be ignored as we always find wayland-client.pc -    # first). -    if(NOT Wayland_VERSION) -        find_file(Wayland_VERSION_HEADER -            NAMES wayland-version.h -            HINTS ${Wayland_INCLUDE_DIRS} +# If pkg-config didn't provide us with version information, +# try to extract it from wayland-version.h +# (Note that the version from wayland-egl.pc will probably be +# the Mesa version, rather than the Wayland version, but that +# version will be ignored as we always find wayland-client.pc +# first). +if(NOT Wayland_VERSION) +    find_file(Wayland_VERSION_HEADER +        NAMES wayland-version.h +        HINTS ${Wayland_INCLUDE_DIRS} +    ) +    mark_as_advanced(Wayland_VERSION_HEADER) +    if(Wayland_VERSION_HEADER) +        file(READ ${Wayland_VERSION_HEADER} _wayland_version_header_contents) +        string(REGEX REPLACE +            "^.*[ \\t]+WAYLAND_VERSION[ \\t]+\"([0-9.]*)\".*$" +            "\\1" +            Wayland_VERSION +            "${_wayland_version_header_contents}"          ) -        mark_as_advanced(Wayland_VERSION_HEADER) -        if(Wayland_VERSION_HEADER) -            file(READ ${Wayland_VERSION_HEADER} _wayland_version_header_contents) -            string(REGEX REPLACE -                "^.*[ \\t]+WAYLAND_VERSION[ \\t]+\"([0-9.]*)\".*$" -                "\\1" -                Wayland_VERSION -                "${_wayland_version_header_contents}" -            ) -            unset(_wayland_version_header_contents) -        endif() +        unset(_wayland_version_header_contents)      endif() - -    find_package_handle_standard_args(Wayland -        FOUND_VAR -            Wayland_FOUND -        REQUIRED_VARS -            Wayland_LIBRARIES -        VERSION_VAR -            Wayland_VERSION -        HANDLE_COMPONENTS -    ) - -else() -    message(STATUS "Wayland is not available on Windows.") -    set(Wayland_FOUND FALSE)  endif() +find_package_handle_standard_args(Wayland +    FOUND_VAR +        Wayland_FOUND +    REQUIRED_VARS +        Wayland_LIBRARIES +    VERSION_VAR +        Wayland_VERSION +    HANDLE_COMPONENTS +) +  include(FeatureSummary)  set_package_properties(Wayland PROPERTIES      URL "http://wayland.freedesktop.org" diff --git a/find-modules/FindWaylandScanner.cmake b/find-modules/FindWaylandScanner.cmake index 4cade50f..33c46f9b 100644 --- a/find-modules/FindWaylandScanner.cmake +++ b/find-modules/FindWaylandScanner.cmake @@ -2,7 +2,7 @@  # FindWaylandScanner  # ------------------  # -# Try to find wayland-scanner on a Unix system. +# Try to find wayland-scanner.  #  # If the wayland-scanner executable is not in your PATH, you can provide  # an alternative name or full path location with the ``WaylandScanner_EXECUTABLE`` @@ -79,29 +79,24 @@ include(${CMAKE_CURRENT_LIST_DIR}/ECMFindModuleHelpersStub.cmake)  ecm_find_package_version_check(WaylandScanner) -if(NOT WIN32) -    # Find wayland-scanner -    find_program(WaylandScanner_EXECUTABLE NAMES wayland-scanner) +# Find wayland-scanner +find_program(WaylandScanner_EXECUTABLE NAMES wayland-scanner) -    include(FindPackageHandleStandardArgs) -    find_package_handle_standard_args(WaylandScanner -        FOUND_VAR -            WaylandScanner_FOUND -        REQUIRED_VARS -            WaylandScanner_EXECUTABLE -    ) +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(WaylandScanner +    FOUND_VAR +        WaylandScanner_FOUND +    REQUIRED_VARS +        WaylandScanner_EXECUTABLE +) -    mark_as_advanced(WaylandScanner_EXECUTABLE) +mark_as_advanced(WaylandScanner_EXECUTABLE) -    if(NOT TARGET Wayland::Scanner AND WaylandScanner_FOUND) -        add_executable(Wayland::Scanner IMPORTED) -        set_target_properties(Wayland::Scanner PROPERTIES -            IMPORTED_LOCATION "${WaylandScanner_EXECUTABLE}" -        ) -    endif() -else() -    message(STATUS "Wayland is not available on Windows.") -    set(WaylandScanner_FOUND FALSE) +if(NOT TARGET Wayland::Scanner AND WaylandScanner_FOUND) +    add_executable(Wayland::Scanner IMPORTED) +    set_target_properties(Wayland::Scanner PROPERTIES +        IMPORTED_LOCATION "${WaylandScanner_EXECUTABLE}" +    )  endif()  include(FeatureSummary) 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 diff --git a/find-modules/FindXCB.cmake b/find-modules/FindXCB.cmake index 76d69fd7..781b15c5 100644 --- a/find-modules/FindXCB.cmake +++ b/find-modules/FindXCB.cmake @@ -2,7 +2,7 @@  # FindXCB  # -------  # -# Try to find XCB on a Unix system. +# Try to find XCB.  #  # This is a component-based find module, which makes use of the COMPONENTS and  # OPTIONAL_COMPONENTS arguments to find_module.  The following components are @@ -85,103 +85,98 @@ include(${CMAKE_CURRENT_LIST_DIR}/ECMFindModuleHelpersStub.cmake)  ecm_find_package_version_check(XCB) -if(NOT WIN32) -    # Note that this list needs to be ordered such that any component -    # appears after its dependencies -    set(XCB_known_components -        XCB -        RENDER -        SHAPE -        XFIXES -        SHM -        ATOM -        AUX -        COMPOSITE -        CURSOR -        DAMAGE -        DPMS -        DRI2 -        DRI3 -        EVENT -        EWMH -        GLX -        ICCCM -        IMAGE -        KEYSYMS -        PRESENT -        RANDR -        RECORD -        RENDERUTIL -        RES -        SCREENSAVER -        SYNC -        UTIL -        XEVIE -        XF86DRI -        XINERAMA -        XINPUT -        XKB -        XPRINT -        XTEST -        XV -        XVMC) -    # default component info: xcb components have fairly predictable -    # header files, library names and pkg-config names -    foreach(_comp ${XCB_known_components}) -        string(TOLOWER "${_comp}" _lc_comp) -        set(XCB_${_comp}_component_deps XCB) -        set(XCB_${_comp}_pkg_config "xcb-${_lc_comp}") -        set(XCB_${_comp}_lib "xcb-${_lc_comp}") -        set(XCB_${_comp}_header "xcb/${_lc_comp}.h") -    endforeach() -    # exceptions -    set(XCB_XCB_component_deps) -    set(XCB_COMPOSITE_component_deps XCB XFIXES) -    set(XCB_DAMAGE_component_deps XCB XFIXES) -    set(XCB_IMAGE_component_deps XCB SHM) -    set(XCB_RENDERUTIL_component_deps XCB RENDER) -    set(XCB_XFIXES_component_deps XCB RENDER SHAPE) -    set(XCB_XVMC_component_deps XCB XV) -    set(XCB_XV_component_deps XCB SHM) -    set(XCB_XCB_pkg_config "xcb") -    set(XCB_XCB_lib "xcb") -    set(XCB_ATOM_header "xcb/xcb_atom.h") -    set(XCB_ATOM_lib "xcb-util") -    set(XCB_AUX_header "xcb/xcb_aux.h") -    set(XCB_AUX_lib "xcb-util") -    set(XCB_CURSOR_header "xcb/xcb_cursor.h") -    set(XCB_EVENT_header "xcb/xcb_event.h") -    set(XCB_EVENT_lib "xcb-util") -    set(XCB_EWMH_header "xcb/xcb_ewmh.h") -    set(XCB_ICCCM_header "xcb/xcb_icccm.h") -    set(XCB_IMAGE_header "xcb/xcb_image.h") -    set(XCB_KEYSYMS_header "xcb/xcb_keysyms.h") -    set(XCB_PIXEL_header "xcb/xcb_pixel.h") -    set(XCB_RENDERUTIL_header "xcb/xcb_renderutil.h") -    set(XCB_RENDERUTIL_lib "xcb-render-util") -    set(XCB_UTIL_header "xcb/xcb_util.h") +# Note that this list needs to be ordered such that any component +# appears after its dependencies +set(XCB_known_components +    XCB +    RENDER +    SHAPE +    XFIXES +    SHM +    ATOM +    AUX +    COMPOSITE +    CURSOR +    DAMAGE +    DPMS +    DRI2 +    DRI3 +    EVENT +    EWMH +    GLX +    ICCCM +    IMAGE +    KEYSYMS +    PRESENT +    RANDR +    RECORD +    RENDERUTIL +    RES +    SCREENSAVER +    SYNC +    UTIL +    XEVIE +    XF86DRI +    XINERAMA +    XINPUT +    XKB +    XPRINT +    XTEST +    XV +    XVMC) +# default component info: xcb components have fairly predictable +# header files, library names and pkg-config names +foreach(_comp ${XCB_known_components}) +    string(TOLOWER "${_comp}" _lc_comp) +    set(XCB_${_comp}_component_deps XCB) +    set(XCB_${_comp}_pkg_config "xcb-${_lc_comp}") +    set(XCB_${_comp}_lib "xcb-${_lc_comp}") +    set(XCB_${_comp}_header "xcb/${_lc_comp}.h") +endforeach() +# exceptions +set(XCB_XCB_component_deps) +set(XCB_COMPOSITE_component_deps XCB XFIXES) +set(XCB_DAMAGE_component_deps XCB XFIXES) +set(XCB_IMAGE_component_deps XCB SHM) +set(XCB_RENDERUTIL_component_deps XCB RENDER) +set(XCB_XFIXES_component_deps XCB RENDER SHAPE) +set(XCB_XVMC_component_deps XCB XV) +set(XCB_XV_component_deps XCB SHM) +set(XCB_XCB_pkg_config "xcb") +set(XCB_XCB_lib "xcb") +set(XCB_ATOM_header "xcb/xcb_atom.h") +set(XCB_ATOM_lib "xcb-util") +set(XCB_AUX_header "xcb/xcb_aux.h") +set(XCB_AUX_lib "xcb-util") +set(XCB_CURSOR_header "xcb/xcb_cursor.h") +set(XCB_EVENT_header "xcb/xcb_event.h") +set(XCB_EVENT_lib "xcb-util") +set(XCB_EWMH_header "xcb/xcb_ewmh.h") +set(XCB_ICCCM_header "xcb/xcb_icccm.h") +set(XCB_IMAGE_header "xcb/xcb_image.h") +set(XCB_KEYSYMS_header "xcb/xcb_keysyms.h") +set(XCB_PIXEL_header "xcb/xcb_pixel.h") +set(XCB_RENDERUTIL_header "xcb/xcb_renderutil.h") +set(XCB_RENDERUTIL_lib "xcb-render-util") +set(XCB_UTIL_header "xcb/xcb_util.h") -    ecm_find_package_parse_components(XCB -        RESULT_VAR XCB_components -        KNOWN_COMPONENTS ${XCB_known_components} -    ) -    ecm_find_package_handle_library_components(XCB -        COMPONENTS ${XCB_components} -    ) +ecm_find_package_parse_components(XCB +    RESULT_VAR XCB_components +    KNOWN_COMPONENTS ${XCB_known_components} +) +ecm_find_package_handle_library_components(XCB +    COMPONENTS ${XCB_components} +) -    find_package_handle_standard_args(XCB -        FOUND_VAR -            XCB_FOUND -        REQUIRED_VARS -            XCB_LIBRARIES -        VERSION_VAR -            XCB_VERSION -        HANDLE_COMPONENTS -    ) -else() -    message(STATUS "XCB is not available on Windows.") -    set(XCB_FOUND FALSE) -endif() +find_package_handle_standard_args(XCB +    FOUND_VAR +        XCB_FOUND +    REQUIRED_VARS +        XCB_LIBRARIES +    VERSION_VAR +        XCB_VERSION +    HANDLE_COMPONENTS +)  include(FeatureSummary)  set_package_properties(XCB PROPERTIES | 
