FindWiiUse.cmake 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. # - try to find WiiUse library
  2. #
  3. # Cache Variables: (probably not for direct use in your scripts)
  4. # WIIUSE_INCLUDE_DIR
  5. # WIIUSE_LIBRARY
  6. #
  7. # Non-cache variables you might use in your CMakeLists.txt:
  8. # WIIUSE_FOUND
  9. # WIIUSE_INCLUDE_DIRS
  10. # WIIUSE_LIBRARIES
  11. # WIIUSE_RUNTIME_LIBRARIES - aka the dll for installing
  12. # WIIUSE_RUNTIME_LIBRARY_DIRS
  13. #
  14. # Requires these CMake modules:
  15. # FindPackageHandleStandardArgs (known included with CMake >=2.6.2)
  16. #
  17. # Original Author:
  18. # 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
  19. # http://academic.cleardefinition.com
  20. # Iowa State University HCI Graduate Program/VRAC
  21. #
  22. # Copyright Iowa State University 2009-2010.
  23. # Distributed under the Boost Software License, Version 1.0.
  24. # (See accompanying file LICENSE_1_0.txt or copy at
  25. # http://www.boost.org/LICENSE_1_0.txt)
  26. set(WIIUSE_ROOT_DIR
  27. "${WIIUSE_ROOT_DIR}"
  28. CACHE
  29. PATH
  30. "Directory to search for WiiUse")
  31. if(CMAKE_SIZEOF_VOID_P MATCHES "8")
  32. set(_LIBSUFFIXES /lib64 /lib)
  33. else()
  34. set(_LIBSUFFIXES /lib)
  35. endif()
  36. find_library(WIIUSE_LIBRARY
  37. NAMES
  38. wiiuse
  39. PATHS
  40. "${WIIUSE_ROOT_DIR}"
  41. PATH_SUFFIXES
  42. "${_LIBSUFFIXES}")
  43. get_filename_component(_libdir "${WIIUSE_LIBRARY}" PATH)
  44. find_path(WIIUSE_INCLUDE_DIR
  45. NAMES
  46. wiiuse.h
  47. HINTS
  48. "${_libdir}"
  49. "${_libdir}/.."
  50. PATHS
  51. "${WIIUSE_ROOT_DIR}"
  52. PATH_SUFFIXES
  53. include/)
  54. set(_deps_check)
  55. if(WIN32)
  56. find_file(WIIUSE_RUNTIME_LIBRARY
  57. NAMES
  58. wiiuse.dll
  59. HINTS
  60. "${_libdir}"
  61. "${_libdir}/.."
  62. PATH_SUFFIXES
  63. bin)
  64. set(WIIUSE_RUNTIME_LIBRARIES "${WIIUSE_RUNTIME_LIBRARY}")
  65. get_filename_component(WIIUSE_RUNTIME_LIBRARY_DIRS
  66. "${WIIUSE_RUNTIME_LIBRARY}"
  67. PATH)
  68. list(APPEND _deps_check WIIUSE_RUNTIME_LIBRARY)
  69. else()
  70. set(WIIUSE_RUNTIME_LIBRARY "${WIIUSE_LIBRARY}")
  71. set(WIIUSE_RUNTIME_LIBRARIES "${WIIUSE_RUNTIME_LIBRARY}")
  72. get_filename_component(WIIUSE_RUNTIME_LIBRARY_DIRS
  73. "${WIIUSE_LIBRARY}"
  74. PATH)
  75. endif()
  76. include(FindPackageHandleStandardArgs)
  77. find_package_handle_standard_args(WiiUse
  78. DEFAULT_MSG
  79. WIIUSE_LIBRARY
  80. WIIUSE_INCLUDE_DIR
  81. ${_deps_check})
  82. if(WIIUSE_FOUND)
  83. set(WIIUSE_LIBRARIES "${WIIUSE_LIBRARY}")
  84. set(WIIUSE_INCLUDE_DIRS "${WIIUSE_INCLUDE_DIR}")
  85. mark_as_advanced(WIIUSE_ROOT_DIR)
  86. endif()
  87. mark_as_advanced(WIIUSE_INCLUDE_DIR
  88. WIIUSE_LIBRARY
  89. WIIUSE_RUNTIME_LIBRARY)