-
Notifications
You must be signed in to change notification settings - Fork 10
/
FindOpenNI2.cmake
77 lines (69 loc) · 2.94 KB
/
FindOpenNI2.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
###############################################################################
# Find OpenNI2
#
# This sets the following variables:
# OPENNI2_FOUND - True if OPENNI was found.
# OPENNI2_INCLUDE_DIRS - Directories containing the OPENNI include files.
# OPENNI2_LIBRARIES - Libraries needed to use OPENNI.
find_package(PkgConfig)
if(${CMAKE_VERSION} VERSION_LESS 2.8.2)
pkg_check_modules(PC_OPENNI openni2-dev)
else()
pkg_check_modules(PC_OPENNI QUIET openni2-dev)
endif()
set(OPENNI2_DEFINITIONS ${PC_OPENNI_CFLAGS_OTHER})
#add a hint so that it can find it without the pkg-config
find_path(OPENNI2_INCLUDE_DIR OpenNI.h
HINTS
${PC_OPENNI_INCLUDEDIR}
${PC_OPENNI_INCLUDE_DIRS}
PATHS
"${PROGRAM_FILES}/OpenNI2/Include"
"${CMAKE_SOURCE_DIR}/../OpenNI2/Include"
"${CMAKE_SOURCE_DIR}/../../OpenNI2/Include"
"${CMAKE_SOURCE_DIR}/../../../OpenNI2/Include"
"${CMAKE_SOURCE_DIR}/../../../../OpenNI2/Include"
"${CMAKE_SOURCE_DIR}/../../../code/OpenNI2/Include"
"${CMAKE_SOURCE_DIR}/../../../../code/OpenNI2/Include"
"${CMAKE_SOURCE_DIR}/../deps/OpenNI2/Include"
"${CMAKE_SOURCE_DIR}/../../deps/OpenNI2/Include"
"${CMAKE_SOURCE_DIR}/../../../deps/OpenNI2/Include"
"${CMAKE_SOURCE_DIR}/../../../../deps/OpenNI2/Include"
/usr/include
/user/include
PATH_SUFFIXES openni2 ni2
)
if(${CMAKE_CL_64})
set(OPENNI_PATH_SUFFIXES lib64)
else()
set(OPENNI_PATH_SUFFIXES lib)
endif()
#add a hint so that it can find it without the pkg-config
find_library(OPENNI2_LIBRARY
NAMES OpenNI2
HINTS
${PC_OPENNI_LIBDIR}
${PC_OPENNI_LIBRARY_DIRS}
PATHS
"${PROGRAM_FILES}}/OpenNI2/Redist"
"${PROGRAM_FILES}/OpenNI2"
"${CMAKE_SOURCE_DIR}/../OpenNI2/Bin/x64-Release"
"${CMAKE_SOURCE_DIR}/../../OpenNI2/Bin/x64-Release"
"${CMAKE_SOURCE_DIR}/../../../OpenNI2/Bin/x64-Release"
"${CMAKE_SOURCE_DIR}/../../../../OpenNI2/Bin/x64-Release"
"${CMAKE_SOURCE_DIR}/../../../code/OpenNI2/Bin/x64-Release"
"${CMAKE_SOURCE_DIR}/../../../../code/OpenNI2/Bin/x64-Release"
"${CMAKE_SOURCE_DIR}/../deps/OpenNI2/Bin/x64-Release"
"${CMAKE_SOURCE_DIR}/../../deps/OpenNI2/Bin/x64-Release"
"${CMAKE_SOURCE_DIR}/../../../deps/OpenNI2/Bin/x64-Release"
"${CMAKE_SOURCE_DIR}/../../../../deps/OpenNI2/Bin/x64-Release"
/usr/lib
/user/lib
PATH_SUFFIXES ${OPENNI_PATH_SUFFIXES}
)
set(OPENNI2_INCLUDE_DIRS ${OPENNI2_INCLUDE_DIR})
set(OPENNI2_LIBRARIES ${OPENNI2_LIBRARY})
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(OpenNI2 DEFAULT_MSG
OPENNI2_LIBRARY OPENNI2_INCLUDE_DIR)
mark_as_advanced(OPENNI2_LIBRARY OPENNI2_INCLUDE_DIR)