Browse Source

FindGLUT: Add library dependencies only if they exist

Fixes: #14060
Brad King 8 years ago
parent
commit
e1b67d0373
1 changed files with 5 additions and 3 deletions
  1. 5 3
      Modules/FindGLUT.cmake

+ 5 - 3
Modules/FindGLUT.cmake

@@ -120,10 +120,12 @@ if (GLUT_FOUND)
   # If not, we need some way to figure out what platform we are on.
   set( GLUT_LIBRARIES
     ${GLUT_glut_LIBRARY}
-    ${GLUT_Xmu_LIBRARY}
-    ${GLUT_Xi_LIBRARY}
-    ${GLUT_cocoa_LIBRARY}
     )
+  foreach(v GLUT_Xmu_LIBRARY GLUT_Xi_LIBRARY GLUT_cocoa_LIBRARY)
+    if(${v})
+      list(APPEND GLUT_LIBRARIES ${${v}})
+    endif()
+  endforeach()
 
   if(NOT TARGET GLUT::GLUT)
     add_library(GLUT::GLUT UNKNOWN IMPORTED)