File: FindLeapV2.cmake

package info (click to toggle)
freespace2 25.0.0%2Brepack-1
  • links: PTS, VCS
  • area: non-free
  • in suites: forky, sid
  • size: 47,232 kB
  • sloc: cpp: 657,500; ansic: 22,305; sh: 293; python: 200; makefile: 198; xml: 181
file content (64 lines) | stat: -rw-r--r-- 1,774 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# Copyright 2019-2021, Collabora, Ltd.
#
# SPDX-License-Identifier: BSL-1.0
#
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
#
# Original Author:
# 2021 Moses Turner <moses@collabora.com>

#.rst:
# FindLeapV2
# ---------------
#
# Find the Ultraleap v2 drivers
#
# Targets
# ^^^^^^^
#
# If successful, the following import target is created.
#
# ``LeapV2::LeapV2``
#
# Cache variables
# ^^^^^^^^^^^^^^^
#
# The following cache variable may also be set to assist/control the operation of this module:
#
# ``LeapV2_ROOT_DIR``
#  The root to search for Leap v2.
#

set(LeapV2_ROOT_DIR
    "${LeapV2_ROOT_DIR}"
    CACHE PATH "Root to search for LeapV2")

find_path(
    LeapV2_INCLUDE_DIR
    NAMES Leap.h LeapMath.h
    PATHS ${LeapV2_ROOT_DIR}
    PATH_SUFFIXES include)
find_library(
    LeapV2_LIBRARY
    NAMES Leap
    PATHS ${LeapV2_ROOT_DIR}
    PATH_SUFFIXES lib lib/x64)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(LeapV2 REQUIRED_VARS LeapV2_INCLUDE_DIR
                                                       LeapV2_LIBRARY)
if(LeapV2_FOUND)
    set(LeapV2_INCLUDE_DIRS "${LeapV2_INCLUDE_DIR}")
    set(LeapV2_LIBRARIES "${LeapV2_LIBRARY}")
    if(NOT TARGET LeapV2::LeapV2)
        add_library(LeapV2::LeapV2 UNKNOWN IMPORTED)
    endif()
    set_target_properties(
        LeapV2::LeapV2 PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
                                  "${LeapV2_INCLUDE_DIR}")
    set_target_properties(LeapV2::LeapV2 PROPERTIES IMPORTED_LOCATION
                                                    "${LeapV2_LIBRARY}")
    mark_as_advanced(LeapV2_INCLUDE_DIR LeapV2_LIBRARY)
endif()
mark_as_advanced(LeapV2_ROOT_DIR)