The open source OpenXR runtime
1# Copyright 2019-2021, Collabora, Ltd.
2#
3# SPDX-License-Identifier: BSL-1.0
4#
5# Distributed under the Boost Software License, Version 1.0.
6# (See accompanying file LICENSE_1_0.txt or copy at
7# http://www.boost.org/LICENSE_1_0.txt)
8#
9# Original Author:
10# 2021 Moshi Turner <moshiturner@protonmail.com>
11
12#.rst:
13# FindLeapV2
14# ---------------
15#
16# Find the Ultraleap v2 drivers
17#
18# Targets
19# ^^^^^^^
20#
21# If successful, the following import target is created.
22#
23# ``LeapV2::LeapV2``
24#
25# Cache variables
26# ^^^^^^^^^^^^^^^
27#
28# The following cache variable may also be set to assist/control the operation of this module:
29#
30# ``LeapV2_ROOT_DIR``
31# The root to search for Leap v2.
32#
33
34set(LeapV2_ROOT_DIR
35 "${LeapV2_ROOT_DIR}"
36 CACHE PATH "Root to search for LeapV2")
37
38find_path(
39 LeapV2_INCLUDE_DIR
40 NAMES Leap.h LeapMath.h
41 PATHS ${LeapV2_ROOT_DIR}
42 PATH_SUFFIXES include)
43find_library(
44 LeapV2_LIBRARY
45 NAMES Leap
46 PATHS ${LeapV2_ROOT_DIR}
47 PATH_SUFFIXES lib lib/x64)
48include(FindPackageHandleStandardArgs)
49find_package_handle_standard_args(LeapV2 REQUIRED_VARS LeapV2_INCLUDE_DIR
50 LeapV2_LIBRARY)
51if(LeapV2_FOUND)
52 set(LeapV2_INCLUDE_DIRS "${LeapV2_INCLUDE_DIR}")
53 set(LeapV2_LIBRARIES "${LeapV2_LIBRARY}")
54 if(NOT TARGET LeapV2::LeapV2)
55 add_library(LeapV2::LeapV2 UNKNOWN IMPORTED)
56 endif()
57 set_target_properties(
58 LeapV2::LeapV2 PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
59 "${LeapV2_INCLUDE_DIR}")
60 set_target_properties(LeapV2::LeapV2 PROPERTIES IMPORTED_LOCATION
61 "${LeapV2_LIBRARY}")
62 mark_as_advanced(LeapV2_INCLUDE_DIR LeapV2_LIBRARY)
63endif()
64mark_as_advanced(LeapV2_ROOT_DIR)