Backported #6865: Disable websockets command line option
[platform/upstream/freerdp.git] / cmake / FindXi.cmake
1 # - Find Xi
2 # Find the Xi libraries
3 #
4 #  This module defines the following variables:
5 #     XI_FOUND        - true if XI_INCLUDE_DIR & XI_LIBRARY are found
6 #     XI_LIBRARIES    - Set when XI_LIBRARY is found
7 #     XI_INCLUDE_DIRS - Set when XI_INCLUDE_DIR is found
8 #
9 #     XI_INCLUDE_DIR  - where to find XInput2.h, etc.
10 #     XI_LIBRARY      - the Xi library
11 #
12
13 #=============================================================================
14 # Copyright 2011 O.S. Systems Software Ltda.
15 # Copyright 2011 Otavio Salvador <otavio@ossystems.com.br>
16 # Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
17 # Copyright 2013 Corey Clayton <can.of.tuna@gmail.com>
18 #
19 # Licensed under the Apache License, Version 2.0 (the "License");
20 # you may not use this file except in compliance with the License.
21 # You may obtain a copy of the License at
22 #
23 #     http://www.apache.org/licenses/LICENSE-2.0
24 #
25 # Unless required by applicable law or agreed to in writing, software
26 # distributed under the License is distributed on an "AS IS" BASIS,
27 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
28 # See the License for the specific language governing permissions and
29 # limitations under the License.
30 #=============================================================================
31
32 include(CheckSymbolExists)
33
34 find_path(XI_INCLUDE_DIR NAMES X11/extensions/XInput2.h
35           PATHS /opt/X11/include
36           DOC "The Xi include directory")
37
38 find_library(XI_LIBRARY NAMES Xi
39           PATHS /opt/X11/lib
40           DOC "The Xi library")
41
42 include(FindPackageHandleStandardArgs)
43 FIND_PACKAGE_HANDLE_STANDARD_ARGS(Xi DEFAULT_MSG XI_LIBRARY XI_INCLUDE_DIR)
44
45 if(XI_FOUND)
46         check_symbol_exists(XITouchClass "${XI_INCLUDE_DIR}/X11/extensions/XInput2.h" HAVE_XI_TOUCH_CLASS)
47
48         if (NOT HAVE_XI_TOUCH_CLASS)
49                 set(XI_FOUND 0)
50         endif()
51 endif()
52
53 if(XI_FOUND)
54         set(XI_LIBRARIES ${XI_LIBRARY})
55         set(XI_INCLUDE_DIRS ${XI_INCLUDE_DIR})
56 endif()
57
58 mark_as_advanced(XI_INCLUDE_DIR XI_LIBRARY)
59