Permalink
Browse files

Improve vrpn/quatlib finders to find the default locations on Windows

  • Loading branch information...
1 parent 450a051 commit 449fe463184ed7124e4e51522d0bbd23de3247f1 @rpavlik committed Jan 21, 2011
Showing with 33 additions and 8 deletions.
  1. +19 −3 FindVRPN.cmake
  2. +14 −5 Findquatlib.cmake
View
22 FindVRPN.cmake
@@ -34,8 +34,18 @@ set(VRPN_ROOT_DIR
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()
###
@@ -49,23 +59,29 @@ find_path(VRPN_INCLUDE_DIR
include
include/vrpn
HINTS
- "${VRPN_ROOT_DIR}")
+ "${VRPN_ROOT_DIR}"
+ PATHS
+ "${_progfiles}/VRPN")
find_library(VRPN_LIBRARY
NAMES
vrpn
PATH_SUFFIXES
${_libsuffixes}
HINTS
- "${VRPN_ROOT_DIR}")
+ "${VRPN_ROOT_DIR}"
+ PATHS
+ "${_progfiles}/VRPN")
find_library(VRPN_SERVER_LIBRARY
NAMES
vrpnserver
PATH_SUFFIXES
${_libsuffixes}
HINTS
- "${VRPN_ROOT_DIR}")
+ "${VRPN_ROOT_DIR}"
+ PATHS
+ "${_progfiles}/VRPN")
###
# Dependencies
View
19 Findquatlib.cmake
@@ -35,8 +35,18 @@ else()
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.
@@ -48,8 +58,8 @@ else()
PATH_SUFFIXES
include
PATHS
- "C:/Program Files/quatlib/include"
- "../quat")
+ "${_progfiles}/VRPN"
+ "${_progfiles}/quatlib")
# Look for the library.
find_library(QUATLIB_LIBRARY
@@ -61,9 +71,8 @@ else()
PATH_SUFFIXES
${_libsuffixes}
PATHS
- "C:/Program Files/quatlib/lib"
- "../buildquat"
- "../buildquat/release")
+ "${_progfiles}/VRPN"
+ "${_progfiles}/quatlib")
endif()
# handle the QUIETLY and REQUIRED arguments and set QUATLIB_FOUND to TRUE if

0 comments on commit 449fe46

Please sign in to comment.