diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-04-06 03:31:01 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-04-06 03:31:01 +0400 |
commit | ca254dd37b5dd2c52a88d952569a20026fcae6cb (patch) | |
tree | cfdf86a227ea773862dc5473e91cdab2e875d427 /build_files/cmake | |
parent | d5d9c56cb54870edd08a2363178f573eebe08601 (diff) |
add option WITH_BUILTIN_GLEW, so linux packagers can disable to use their own glew library.
Diffstat (limited to 'build_files/cmake')
-rw-r--r-- | build_files/cmake/Modules/FindGLEW.cmake | 59 | ||||
-rw-r--r-- | build_files/cmake/macros.cmake | 4 |
2 files changed, 63 insertions, 0 deletions
diff --git a/build_files/cmake/Modules/FindGLEW.cmake b/build_files/cmake/Modules/FindGLEW.cmake new file mode 100644 index 00000000000..0d319f67f01 --- /dev/null +++ b/build_files/cmake/Modules/FindGLEW.cmake @@ -0,0 +1,59 @@ +# +# Try to find GLEW library and include path. +# Once done this will define +# +# GLEW_FOUND +# GLEW_INCLUDE_PATH +# GLEW_LIBRARY +# + +IF (WIN32) + FIND_PATH( GLEW_INCLUDE_PATH GL/glew.h + $ENV{PROGRAMFILES}/GLEW/include + ${PROJECT_SOURCE_DIR}/src/nvgl/glew/include + DOC "The directory where GL/glew.h resides") + IF (NV_SYSTEM_PROCESSOR STREQUAL "AMD64") + FIND_LIBRARY( GLEW_LIBRARY + NAMES glew64 glew64s + PATHS + $ENV{PROGRAMFILES}/GLEW/lib + ${PROJECT_SOURCE_DIR}/src/nvgl/glew/bin + ${PROJECT_SOURCE_DIR}/src/nvgl/glew/lib + DOC "The GLEW library (64-bit)" + ) + ELSE(NV_SYSTEM_PROCESSOR STREQUAL "AMD64") + FIND_LIBRARY( GLEW_LIBRARY + NAMES glew GLEW glew32 glew32s + PATHS + $ENV{PROGRAMFILES}/GLEW/lib + ${PROJECT_SOURCE_DIR}/src/nvgl/glew/bin + ${PROJECT_SOURCE_DIR}/src/nvgl/glew/lib + DOC "The GLEW library" + ) + ENDIF(NV_SYSTEM_PROCESSOR STREQUAL "AMD64") +ELSE (WIN32) + FIND_PATH( GLEW_INCLUDE_PATH GL/glew.h + /usr/include + /usr/local/include + /sw/include + /opt/local/include + DOC "The directory where GL/glew.h resides") + FIND_LIBRARY( GLEW_LIBRARY + NAMES GLEW glew + PATHS + /usr/lib64 + /usr/lib + /usr/local/lib64 + /usr/local/lib + /sw/lib + /opt/local/lib + DOC "The GLEW library") +ENDIF (WIN32) + +IF (GLEW_INCLUDE_PATH) + SET( GLEW_FOUND 1 CACHE STRING "Set to 1 if GLEW is found, 0 otherwise") +ELSE (GLEW_INCLUDE_PATH) + SET( GLEW_FOUND 0 CACHE STRING "Set to 1 if GLEW is found, 0 otherwise") +ENDIF (GLEW_INCLUDE_PATH) + +MARK_AS_ADVANCED( GLEW_FOUND )
\ No newline at end of file diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake index 24dc058c4b0..a4a6922bca3 100644 --- a/build_files/cmake/macros.cmake +++ b/build_files/cmake/macros.cmake @@ -138,6 +138,10 @@ macro(setup_liblinks endif() endif() + if(NOT WITH_BUILTIN_GLEW) + target_link_libraries(${target} ${GLEW_LIBRARY}) + endif() + target_link_libraries(${target} ${OPENGL_glu_LIBRARY} ${JPEG_LIBRARIES} ${PNG_LIBRARIES} ${ZLIB_LIBRARIES}) target_link_libraries(${target} ${FREETYPE_LIBRARY}) |