FindSpacenav.cmake 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. # - Find Spacenav library
  2. # Find the native Spacenav includes and library
  3. # This module defines
  4. # SPACENAV_INCLUDE_DIRS, where to find spnav.h, Set when
  5. # SPACENAV_INCLUDE_DIR is found.
  6. # SPACENAV_LIBRARIES, libraries to link against to use Spacenav.
  7. # SPACENAV_ROOT_DIR, The base directory to search for Spacenav.
  8. # This can also be an environment variable.
  9. # SPACENAV_FOUND, If false, do not try to use Spacenav.
  10. #
  11. # also defined, but not for general use are
  12. # SPACENAV_LIBRARY, where to find the Spacenav library.
  13. #=============================================================================
  14. # Copyright 2011 Blender Foundation.
  15. #
  16. # Distributed under the OSI-approved BSD License (the "License");
  17. # see accompanying file Copyright.txt for details.
  18. #
  19. # This software is distributed WITHOUT ANY WARRANTY; without even the
  20. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  21. # See the License for more information.
  22. #=============================================================================
  23. # If SPACENAV_ROOT_DIR was defined in the environment, use it.
  24. IF(NOT SPACENAV_ROOT_DIR AND NOT $ENV{SPACENAV_ROOT_DIR} STREQUAL "")
  25. SET(SPACENAV_ROOT_DIR $ENV{SPACENAV_ROOT_DIR})
  26. ENDIF()
  27. SET(_spacenav_SEARCH_DIRS
  28. ${SPACENAV_ROOT_DIR}
  29. /usr/local
  30. /sw # Fink
  31. /opt/local # DarwinPorts
  32. /opt/csw # Blastwave
  33. )
  34. FIND_PATH(SPACENAV_INCLUDE_DIR
  35. NAMES
  36. spnav.h
  37. HINTS
  38. ${_spacenav_SEARCH_DIRS}
  39. PATH_SUFFIXES
  40. include
  41. )
  42. FIND_LIBRARY(SPACENAV_LIBRARY
  43. NAMES
  44. spnav
  45. HINTS
  46. ${_spacenav_SEARCH_DIRS}
  47. PATH_SUFFIXES
  48. lib64 lib
  49. )
  50. # handle the QUIETLY and REQUIRED arguments and set SPACENAV_FOUND to TRUE if
  51. # all listed variables are TRUE
  52. INCLUDE(FindPackageHandleStandardArgs)
  53. FIND_PACKAGE_HANDLE_STANDARD_ARGS(Spacenav DEFAULT_MSG
  54. SPACENAV_LIBRARY SPACENAV_INCLUDE_DIR)
  55. IF(SPACENAV_FOUND)
  56. SET(SPACENAV_LIBRARIES ${SPACENAV_LIBRARY})
  57. SET(SPACENAV_INCLUDE_DIRS ${SPACENAV_INCLUDE_DIR})
  58. ENDIF(SPACENAV_FOUND)
  59. MARK_AS_ADVANCED(
  60. SPACENAV_INCLUDE_DIR
  61. SPACENAV_LIBRARY
  62. )