Make OpenGL/GLUT/GLEW optional.
authorJosé Fonseca <jose.r.fonseca@gmail.com>
Wed, 9 May 2012 08:25:19 +0000 (09:25 +0100)
committerJosé Fonseca <jose.r.fonseca@gmail.com>
Wed, 9 May 2012 08:25:19 +0000 (09:25 +0100)
CMakeLists.txt
apps/CMakeLists.txt
cmake/FindGLEW.cmake [new file with mode: 0644]

index 67bbb3c2492f6b0a2762f114d9705d39a3d4d10d..c6a8a59744c458904ba5c5ef5ad629cba50b8183 100644 (file)
@@ -14,8 +14,10 @@ endif ()
 
 include (FindPkgConfig)
 
+set (CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
+
 if (APITRACE_SOURCE_DIR)
-    set (CMAKE_MODULE_PATH ${APITRACE_SOURCE_DIR}/cmake)
+    set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${APITRACE_SOURCE_DIR}/cmake)
     find_package (DirectX)
 endif ()
 
@@ -29,11 +31,9 @@ endif (NOT CMAKE_BUILD_TYPE)
 
 include (CMakeParseArguments)
 
-find_package (OpenGL REQUIRED)
+find_package (OpenGL)
 find_package (GLUT)
-
-find_path (GLEW_INCLUDE_DIR GL/glew.h /usr/include/GL)
-find_library (GLEW_glew_LIBRARY GLEW /usr/lib)
+find_package (GLEW)
 
 if (NOT WIN32)
        pkg_check_modules (EGL egl)
index 7218458c481dc1c0475e16773ceecf60ae40bce8..b6225050ba59c6bb9695973492136fe5f506c7ed 100644 (file)
@@ -24,7 +24,7 @@ function (ADD_APP_TEST)
     )
 endfunction ()
 
-if (OPENGL_FOUND)
+if (OPENGL_FOUND AND GLEW_FOUND AND GLUT_FOUND)
     add_subdirectory (gl)
 endif ()
 
diff --git a/cmake/FindGLEW.cmake b/cmake/FindGLEW.cmake
new file mode 100644 (file)
index 0000000..8fe9d98
--- /dev/null
@@ -0,0 +1,8 @@
+find_path (GLEW_INCLUDE_DIR GL/glew.h)
+find_library (GLEW_glew_LIBRARY GLEW)
+
+if (GLEW_INCLUDE_DIR AND GLEW_glew_LIBRARY)
+    set (GLEW_FOUND 1)
+endif ()
+
+mark_as_advanced (GLEW_FOUND)