2 # Find the native Cg Toolkit includes and library
4 # CG_INCLUDE_DIR, where to find cg.h, etc.
5 # CG_LIBRARIES, the libraries needed to use Cg Toolkit.
6 # CG_FOUND, If false, do not try to use Cg.
7 # also defined, but not for general use are
8 # CG_LIBRARY, where to find the Cg Toolkit library.
10 # The following variables can be used to give CMake a hint where to find Cg:
15 FIND_LIBRARY(CG_LIBRARY Cg
16 PATHS ${CG_ROOT} ENV CG_ROOT)
19 MARK_AS_ADVANCED (CG_LIBRARY)
20 SET(CG_LIBRARY_RELEASE ${CG_LIBRARY}/Cg)
21 SET(CG_LIBRARY_DEBUG ${CG_LIBRARY}/Cg)
22 SET(CG_GL_LIBRARY_RELEASE ${CG_LIBRARY}/Cg)
23 SET(CG_GL_LIBRARY_DEBUG ${CG_LIBRARY}/Cg)
24 SET(CG_INCLUDE_DIR ${CG_LIBRARY}/Headers)
25 SET(CG_LIBRARIES_FOUND TRUE)
28 FIND_PATH(CG_INCLUDE_DIR Cg/cg.h
29 PATHS ${CG_ROOT} ENV CG_ROOT
30 PATH_SUFFIXES include)
32 IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
33 SET(_OSG_CG_PATH_SUFFIXES lib64 lib.x64)
34 ELSE(CMAKE_SIZEOF_VOID_P EQUAL 8)
35 SET(_OSG_CG_PATH_SUFFIXES lib)
36 ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 8)
38 SET(CG_NAMES_RELEASE ${CG_NAMES_RELEASE} Cg)
39 FIND_LIBRARY(CG_LIBRARY_RELEASE NAMES ${CG_NAMES_RELEASE}
41 PATHS ${CG_ROOT} ENV CG_ROOT
42 PATH_SUFFIXES ${_OSG_CG_PATH_SUFFIXES})
44 SET(CG_NAMES_DEBUG ${CG_NAMES_DEBUG} Cgd)
45 FIND_LIBRARY(CG_LIBRARY_DEBUG NAMES ${CG_NAMES_DEBUG}
47 PATHS ${CG_ROOT} ENV CG_ROOT
48 PATH_SUFFIXES ${_OSG_CG_PATH_SUFFIXES})
50 SET(CG_GL_NAMES_RELEASE ${CG_GL_NAMES_RELEASE} CgGL)
51 FIND_LIBRARY(CG_GL_LIBRARY_RELEASE NAMES ${CG_GL_NAMES_RELEASE}
53 PATHS ${CG_ROOT} ENV CG_ROOT
54 PATH_SUFFIXES ${_OSG_CG_PATH_SUFFIXES})
56 SET(CG_GL_NAMES_DEBUG ${CG_GL_NAMES_DEBUG} CgGLd)
57 FIND_LIBRARY(CG_GL_LIBRARY_DEBUG NAMES ${CG_GL_NAMES_DEBUG}
59 PATHS ${CG_ROOT} ENV CG_ROOT
60 PATH_SUFFIXES ${_OSG_CG_PATH_SUFFIXES})
64 IF(CG_LIBRARY_DEBUG AND CG_GL_LIBRARY_DEBUG)
65 SET(CG_LIBRARIES_FOUND TRUE)
66 MARK_AS_ADVANCED(CG_LIBRARY_DEBUG)
67 ENDIF(CG_LIBRARY_DEBUG AND CG_GL_LIBRARY_DEBUG)
70 IF(CG_LIBRARY_RELEASE AND CG_GL_LIBRARY_RELEASE)
71 SET(CG_LIBRARIES_FOUND TRUE)
72 MARK_AS_ADVANCED(CG_LIBRARY_RELEASE)
74 MARK_AS_ADVANCED(CG_LIBRARY_DEBUG)
75 SET(CG_LIBRARY_DEBUG ${CG_LIBRARY_RELEASE} CACHE FILEPATH "" FORCE)
76 SET(CG_GL_LIBRARY_DEBUG ${CG_GL_LIBRARY_RELEASE} CACHE FILEPATH "" FORCE)
78 ENDIF(CG_LIBRARY_RELEASE AND CG_GL_LIBRARY_RELEASE)
80 # handle the QUIETLY and REQUIRED arguments and set CG_FOUND to TRUE if
81 # all listed variables are TRUE
82 INCLUDE(FindPackageHandleStandardArgs)
83 FIND_PACKAGE_HANDLE_STANDARD_ARGS(CG DEFAULT_MSG