diff --git a/CMakeLists.txt b/CMakeLists.txt
index c432ba2..c67598f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -267,7 +267,9 @@ message("JAS_HAVE_LIBJPEG: ${JAS_HAVE_LIBJPEG}")
 # Check for the OpenGL and GLUT libraries.
 ################################################################################
 
+if(JAS_ENABLE_OPENGL)
 find_package(OpenGL ${JAS_REQUIRED})
+endif()
 message("JAS_ENABLE_OPENGL: ${JAS_ENABLE_OPENGL}")
 message("OpenGL library found: ${OPENGL_FOUND}")
 if (JAS_ENABLE_OPENGL AND OPENGL_FOUND)
