FindGlut.cmake 1.88 KB
Newer Older
schultezub's avatar
schultezub committed
1
2
3
4
5
6
7
8
# Try to find GLUT library and include path. Once done this will define:
# GLUT_FOUND
# GLUT_DEFINITIONS
# GLUT_INCLUDE_DIR
# GLUT_LIBRARIES (containing both debug and release libraries on win32)
# win32: GLUT_DEBUG_LIBRARY, GLUT_RELEASE_LIBRARY, GLUT_DEBUG_DLLS, GLUT_RELEASE_DLLS

IF(WIN32)
schultezub's avatar
schultezub committed
9
    SET(GLUT_DIR "${CampvisHome}/ext/glut" CACHE PATH "If glut is not found, set this path")
schultezub's avatar
schultezub committed
10
11
12
13
14
15
   
    SET(GLUT_DEFINITIONS "-DGLUT_NO_LIB_PRAGMA")
       
    SET(GLUT_INCLUDE_DIR "${GLUT_DIR}")

    # set debug and release library
schultezub's avatar
schultezub committed
16
    IF(CAMPVIS_WIN32)
schultezub's avatar
schultezub committed
17
18
19
20
21
        SET(GLUT_DEBUG_LIBRARY      "${GLUT_DIR}/lib/win32/glut32.lib")
        SET(GLUT_RELEASE_LIBRARY    "${GLUT_DIR}/lib/win32/glut32.lib")

        SET(GLUT_DEBUG_DLL          "${GLUT_DIR}/lib/win32/glut32.dll")
        SET(GLUT_RELEASE_DLL        "${GLUT_DIR}/lib/win32/glut32.dll")
schultezub's avatar
schultezub committed
22
    ELSEIF(CAMPVIS_WIN64)
schultezub's avatar
schultezub committed
23
24
25
26
27
28
        SET(GLUT_DEBUG_LIBRARY      "${GLUT_DIR}/lib/win64/glut64.lib")
        SET(GLUT_RELEASE_LIBRARY    "${GLUT_DIR}/lib/win64/glut64.lib")
        
        SET(GLUT_DEBUG_DLL          "${GLUT_DIR}/lib/win64/glut64.dll")
        SET(GLUT_RELEASE_DLL        "${GLUT_DIR}/lib/win64/glut64.dll")
    ELSE()
schultezub's avatar
schultezub committed
29
30
        MESSAGE(FATAL_ERROR "Neither CAMPVIS_WIN32 nor CAMPVIS_WIN64 defined!")
    ENDIF(CAMPVIS_WIN32)
schultezub's avatar
schultezub committed
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47

    IF (GLUT_DEBUG_LIBRARY AND GLUT_RELEASE_LIBRARY)
        SET(GLUT_LIBRARIES debug ${GLUT_DEBUG_LIBRARY} optimized ${GLUT_RELEASE_LIBRARY})
    ENDIF()
    
    IF(GLUT_INCLUDE_DIR AND GLUT_LIBRARIES)
        SET(GLUT_FOUND TRUE)
    ELSE()
        SET(GLUT_FOUND FALSE)
    ENDIF()
    
ELSE(WIN32)
    FIND_PACKAGE(GLUT REQUIRED)
    # we don't need the Xmu and Xi libraries, which have been added to ${GLUT_LIBRARIES} (see module)
    SET(GLUT_LIBRARIES ${GLUT_glut_LIBRARY})
ENDIF(WIN32)

schultezub's avatar
schultezub committed
48
UNSET(GlutCAMPVIS_DIR)
schultezub's avatar
schultezub committed
49
MARK_AS_ADVANCED(GLUT_DIR GLUT_INCLUDE_DIR GLUT_LIBRARIES GLUT_DEBUG_LIBRARY GLUT_RELEASE_LIBRARY GLUT_DEBUG_DLL GLUT_RELEASE_DLL)