You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

FindThirdPartyVRPN.cmake 3.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. # ---------------------------------
  2. # Adds VRPN library to the target project
  3. # Adds include path
  4. # Requires FindThirdPartyVRPN_Check.cmake to have been run successfully before
  5. # ---------------------------------
  6. GET_PROPERTY(OV_PRINTED GLOBAL PROPERTY OV_TRIED_ThirdPartyVRPN)
  7. IF(PATH_VRPN)
  8. # Find all library paths
  9. IF(WIN32)
  10. FIND_LIBRARY(LIB_VRPN vrpn PATHS ${PATH_VRPN}/lib NO_DEFAULT_PATH)
  11. FIND_LIBRARY(LIB_VRPN vrpn PATHS ${PATH_VRPN}/lib)
  12. IF(LIB_VRPN)
  13. OV_PRINT(OV_PRINTED " [ OK ] lib ${LIB_VRPN}")
  14. ELSE(LIB_VRPN)
  15. OV_PRINT(OV_PRINTED " [FAILED] lib vrpn")
  16. RETURN()
  17. ENDIF(LIB_VRPN)
  18. FIND_LIBRARY(LIB_VRPN_DEBUG vrpnd PATHS ${PATH_VRPN}/lib NO_DEFAULT_PATH)
  19. FIND_LIBRARY(LIB_VRPN_DEBUG vrpnd PATHS ${PATH_VRPN}/lib)
  20. IF(LIB_VRPN_DEBUG)
  21. OV_PRINT(OV_PRINTED " [ OK ] lib ${LIB_VRPN_DEBUG}")
  22. ELSE(LIB_VRPN_DEBUG)
  23. OV_PRINT(OV_PRINTED " [FAILED] lib vrpnd")
  24. RETURN()
  25. ENDIF(LIB_VRPN_DEBUG)
  26. FIND_LIBRARY(LIB_QUAT quat PATHS ${PATH_VRPN}/lib NO_DEFAULT_PATH)
  27. FIND_LIBRARY(LIB_QUAT quat PATHS ${PATH_VRPN}/lib)
  28. IF(LIB_QUAT)
  29. OV_PRINT(OV_PRINTED " [ OK ] lib ${LIB_QUAT}")
  30. ELSE(LIB_QUAT)
  31. OV_PRINT(OV_PRINTED " [FAILED] lib quat")
  32. RETURN()
  33. ENDIF(LIB_QUAT)
  34. FIND_LIBRARY(LIB_QUAT_DEBUG quatd PATHS ${PATH_VRPN}/lib NO_DEFAULT_PATH)
  35. FIND_LIBRARY(LIB_QUAT_DEBUG quatd PATHS ${PATH_VRPN}/lib)
  36. IF(LIB_QUAT_DEBUG)
  37. OV_PRINT(OV_PRINTED " [ OK ] lib ${LIB_QUAT_DEBUG}")
  38. ELSE(LIB_QUAT_DEBUG)
  39. OV_PRINT(OV_PRINTED " [FAILED] lib quatd")
  40. RETURN()
  41. ENDIF(LIB_QUAT_DEBUG)
  42. ENDIF(WIN32)
  43. IF(UNIX)
  44. FIND_LIBRARY(LIB_VRPNSERVER vrpnserver PATHS ${PATH_VRPN}/lib NO_DEFAULT_PATH)
  45. FIND_LIBRARY(LIB_VRPNSERVER vrpnserver PATHS ${PATH_VRPN}/lib)
  46. IF(LIB_VRPNSERVER)
  47. OV_PRINT(OV_PRINTED " [ OK ] lib ${LIB_VRPNSERVER}")
  48. ELSE(LIB_VRPNSERVER)
  49. OV_PRINT(OV_PRINTED " [FAILED] lib vrpnserver")
  50. RETURN()
  51. ENDIF(LIB_VRPNSERVER)
  52. FIND_LIBRARY(LIB_QUAT quat PATHS ${PATH_VRPN}/lib NO_DEFAULT_PATH)
  53. FIND_LIBRARY(LIB_QUAT quat PATHS ${PATH_VRPN}/lib)
  54. IF(LIB_QUAT)
  55. OV_PRINT(OV_PRINTED " [ OK ] lib ${LIB_QUAT}")
  56. ELSE(LIB_QUAT)
  57. OV_PRINT(OV_PRINTED " [FAILED] lib quat")
  58. RETURN()
  59. ENDIF(LIB_QUAT)
  60. ENDIF(UNIX)
  61. # If we reach here, everything has been found, add
  62. INCLUDE_DIRECTORIES(${PATH_VRPN}/include)
  63. IF(WIN32)
  64. TARGET_LINK_LIBRARIES(${PROJECT_NAME} optimized ${LIB_VRPN})
  65. TARGET_LINK_LIBRARIES(${PROJECT_NAME} debug ${LIB_VRPN_DEBUG})
  66. TARGET_LINK_LIBRARIES(${PROJECT_NAME} optimized ${LIB_QUAT})
  67. TARGET_LINK_LIBRARIES(${PROJECT_NAME} debug ${LIB_QUAT_DEBUG})
  68. ENDIF(WIN32)
  69. IF(UNIX)
  70. TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${LIB_VRPNSERVER})
  71. TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${LIB_QUAT})
  72. ENDIF(UNIX)
  73. ADD_DEFINITIONS(-DTARGET_HAS_ThirdPartyVRPN)
  74. ELSE(PATH_VRPN)
  75. MESSAGE(AUTHOR_WARNING "Should not run FindThirdPartyVRPN without FindThirdPartyVRPN_Check passing successfully first")
  76. ENDIF(PATH_VRPN)
  77. SET_PROPERTY(GLOBAL PROPERTY OV_TRIED_ThirdPartyVRPN "Yes")