-
Notifications
You must be signed in to change notification settings - Fork 213
/
Findquatlib.cmake
99 lines (88 loc) · 2.4 KB
/
Findquatlib.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# - Find quatlib
# Find the quatlib headers and libraries.
#
# QUATLIB_INCLUDE_DIRS - where to find quat.h
# QUATLIB_LIBRARIES - List of libraries when using quatlib.
# QUATLIB_FOUND - True if quatlib found.
#
# Original Author:
# 2009-2010 Ryan Pavlik <[email protected]> <[email protected]>
# http://academic.cleardefinition.com
# Iowa State University HCI Graduate Program/VRAC
#
# Copyright Iowa State University 2009-2010.
# 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)
if(TARGET quat)
# Look for the header file.
find_path(QUATLIB_INCLUDE_DIR NAMES quat.h
PATHS ${quatlib_SOURCE_DIR})
set(QUATLIB_LIBRARY "quat")
else()
set(QUATLIB_ROOT_DIR
"${QUATLIB_ROOT_DIR}"
CACHE
PATH
"Root directory to search for quatlib")
if(DEFINED VRPN_ROOT_DIR AND NOT QUATLIB_ROOT_DIR)
set(QUATLIB_ROOT_DIR "${VRPN_ROOT_DIR}")
mark_as_advanced(QUATLIB_ROOT_DIR)
endif()
if("${CMAKE_SIZEOF_VOID_P}" MATCHES "8")
set(_libsuffixes lib64 lib)
# 64-bit dir: only set on win64
file(TO_CMAKE_PATH "$ENV{ProgramW6432}" _progfiles)
else()
set(_libsuffixes lib)
if(NOT "$ENV{ProgramFiles(x86)}" STREQUAL "")
# 32-bit dir: only set on win64
file(TO_CMAKE_PATH "$ENV{ProgramFiles(x86)}" _progfiles)
else()
# 32-bit dir on win32, useless to us on win64
file(TO_CMAKE_PATH "$ENV{ProgramFiles}" _progfiles)
endif()
endif()
# Look for the header file.
find_path(QUATLIB_INCLUDE_DIR
NAMES
quat.h
HINTS
"${QUATLIB_ROOT_DIR}"
PATH_SUFFIXES
include
PATHS
"${_progfiles}/VRPN"
"${_progfiles}/quatlib")
# Look for the library.
find_library(QUATLIB_LIBRARY
NAMES
quat.lib
libquat.a
HINTS
"${QUATLIB_ROOT_DIR}"
PATH_SUFFIXES
${_libsuffixes}
PATHS
"${_progfiles}/VRPN"
"${_progfiles}/quatlib")
endif()
# handle the QUIETLY and REQUIRED arguments and set QUATLIB_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(quatlib
DEFAULT_MSG
QUATLIB_LIBRARY
QUATLIB_INCLUDE_DIR)
if(QUATLIB_FOUND)
set(QUATLIB_LIBRARIES ${QUATLIB_LIBRARY})
if(NOT WIN32)
list(APPEND QUATLIB_LIBRARIES m)
endif()
set(QUATLIB_INCLUDE_DIRS ${QUATLIB_INCLUDE_DIR})
mark_as_advanced(QUATLIB_ROOT_DIR)
else()
set(QUATLIB_LIBRARIES)
set(QUATLIB_INCLUDE_DIRS)
endif()
mark_as_advanced(QUATLIB_LIBRARY QUATLIB_INCLUDE_DIR)