Browse Source

CMake: Fix libCgGL linkage in FindCg.cmake

This involves both fixing the capitalization of "CgGL" and only adding
libraries to CG_LIBRARIES when they're found.
Sam Edwards 7 years ago
parent
commit
16be0770e7
1 changed files with 9 additions and 4 deletions
  1. 9 4
      cmake/modules/FindCg.cmake

+ 9 - 4
cmake/modules/FindCg.cmake

@@ -42,7 +42,7 @@ macro(find_cggl)
 
 
     # Find the library directory
     # Find the library directory
     find_library(CGGL_LIBRARY
     find_library(CGGL_LIBRARY
-      NAMES "cgGL" "libCgGL"
+      NAMES "CgGL" "libCgGL"
       PATHS "C:/Program Files/Cg"
       PATHS "C:/Program Files/Cg"
             "C:/Program Files/NVIDIA Corporation/Cg"
             "C:/Program Files/NVIDIA Corporation/Cg"
             "/usr"
             "/usr"
@@ -87,7 +87,7 @@ macro(find_cgd3d9)
 
 
     # Find the library directory
     # Find the library directory
     find_library(CGD3D9_LIBRARY
     find_library(CGD3D9_LIBRARY
-      NAMES "cgD3D9" "libCgD3D9"
+      NAMES "CgD3D9" "libCgD3D9"
       PATHS "C:/Program Files/Cg"
       PATHS "C:/Program Files/Cg"
             "C:/Program Files/NVIDIA Corporation/Cg"
             "C:/Program Files/NVIDIA Corporation/Cg"
             "/usr"
             "/usr"
@@ -184,6 +184,11 @@ if(CG_INCLUDE_DIR AND CG_LIBRARY_DIR)
   find_cggl()
   find_cggl()
   find_cgd3d9()
   find_cgd3d9()
 
 
-  set(CG_LIBRARIES ${CG_LIBRARY} ${CGGL_LIBRARY} ${CGD3D9_LIBRARY})
-  mark_as_advanced(CG_LIBRARIES)
+  set(CG_LIBRARIES ${CG_LIBRARY})
+  if(CGGL_LIBRARY)
+    list(APPEND CG_LIBRARIES "${CGGL_LIBRARY}")
+  endif()
+  if(CGD3D9_LIBRARY)
+    list(APPEND CG_LIBRARIES "${CGD3D9_LIBRARY}")
+  endif()
 endif()
 endif()