Forráskód Böngészése

CMake: Fix FindVRPN so it also finds VRPN's quat library

Sam Edwards 7 éve
szülő
commit
3a5c158b5a
1 módosított fájl, 24 hozzáadás és 5 törlés
  1. 24 5
      cmake/modules/FindVRPN.cmake

+ 24 - 5
cmake/modules/FindVRPN.cmake

@@ -7,7 +7,7 @@
 # Once done this will define:
 #   VRPN_FOUND       - system has VRPN
 #   VRPN_INCLUDE_DIR - the include directory containing VRPN header files
-#   VRPN_LIBRARY     - the path to the VRPN client library
+#   VRPN_LIBRARIES   - the path to the VRPN client libraries
 #
 
 if(NOT VRPN_INCLUDE_DIR)
@@ -16,12 +16,31 @@ if(NOT VRPN_INCLUDE_DIR)
   mark_as_advanced(VRPN_INCLUDE_DIR)
 endif()
 
-if(NOT VRPN_LIBRARY)
-  find_library(VRPN_LIBRARY
+if(NOT VRPN_vrpn_LIBRARY)
+  find_library(VRPN_vrpn_LIBRARY
     NAMES "vrpn")
 
-  mark_as_advanced(VRPN_LIBRARY)
+  mark_as_advanced(VRPN_vrpn_LIBRARY)
+endif()
+
+if(VRPN_vrpn_LIBRARY AND NOT VRPN_quat_LIBRARY)
+  get_filename_component(_vrpn_dir "${VRPN_vrpn_LIBRARY}" DIRECTORY)
+  find_library(VRPN_quat_LIBRARY
+    NAMES "quat"
+    PATHS "${_vrpn_dir}"
+    NO_DEFAULT_PATH)
+
+  unset(_vrpn_dir)
+  mark_as_advanced(VRPN_quat_LIBRARY)
+endif()
+
+set(VRPN_LIBRARIES)
+if(VRPN_vrpn_LIBRARY)
+  list(APPEND VRPN_LIBRARIES "${VRPN_vrpn_LIBRARY}")
+endif()
+if(VRPN_quat_LIBRARY)
+  list(APPEND VRPN_LIBRARIES "${VRPN_quat_LIBRARY}")
 endif()
 
 include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(VRPN DEFAULT_MSG VRPN_INCLUDE_DIR VRPN_LIBRARY)
+find_package_handle_standard_args(VRPN DEFAULT_MSG VRPN_INCLUDE_DIR VRPN_LIBRARIES)