forked from leapmotion/cmake-modules
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFindLeap.cmake
63 lines (55 loc) · 1.74 KB
/
FindLeap.cmake
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
#.rst
# FindLeap
# ------------
#
# Created by Walter Gray.
# Locate and configure Leap
#
# Interface Targets
# ^^^^^^^^^^^^^^^^^
# Leap::Leap
#
# Variables
# ^^^^^^^^^
# Leap_ROOT_DIR
# Leap_FOUND
# Leap_INCLUDE_DIR
# Leap_LIBRARY
# Leap_IMPORT_LIB
find_path(Leap_ROOT_DIR
NAMES include/Leap.h
HINTS ${EXTERNAL_LIBRARY_DIR}
PATH_SUFFIXES LeapSDK-${Leap_FIND_VERSION}
LeapSDK)
#we should check the version.txt file here...
set(Leap_INCLUDE_DIR "${Leap_ROOT_DIR}/include")
if(MSVC)
find_library(Leap_IMPORT_LIB_RELEASE "Leap.lib" HINTS "${Leap_ROOT_DIR}/lib/x86")
find_library(Leap_IMPORT_LIB_DEBUG "Leapd.lib" HINTS "${Leap_ROOT_DIR}/lib/x86")
find_file(Leap_LIBRARY_RELEASE
NAMES Leap.dll
HINTS "${Leap_ROOT_DIR}/lib/x86")
find_file(Leap_LIBRARY_DEBUG
NAMES Leapd.dll
Leap.dll #fallback on the release library if we must
HINTS "${Leap_ROOT_DIR}/lib/x86")
mark_as_advanced(Leap_IMPORT_LIB_RELEASE Leap_IMPORT_LIB_DEBUG)
else()
string(FIND "${CMAKE_CXX_FLAGS}" "-stdlib=libc++" found_lib)
if(${found_lib} GREATER -1)
set(_libdir ${Leap_ROOT_DIR}/lib)
else()
set(_libdir ${Leap_ROOT_DIR}/lib/libstdc++)
endif()
find_library(Leap_LIBRARY_RELEASE
NAMES libLeap.dylib
HINTS "${_libdir}")
find_library(Leap_LIBRARY_DEBUG
NAMES libLeapd.dylib
libLeap.dylib #fallback on the release library
HINTS "${_libdir}")
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Leap DEFAULT_MSG Leap_ROOT_DIR Leap_INCLUDE_DIR Leap_LIBRARY_RELEASE Leap_LIBRARY_DEBUG)
include(CreateImportTargetHelpers)
generate_import_target(Leap SHARED)