[Piglit] [PATCH 02/14] cmake: Request GLUT only when Waffle is not used

groleo at gmail.com groleo at gmail.com
Fri Nov 16 04:46:47 PST 2012


From: Adrian Marius Negreanu <adrian.m.negreanu at intel.com>

Signed-off-by: Adrian Marius Negreanu <adrian.m.negreanu at intel.com>
---
 CMakeLists.txt | 30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 82f9ba8..8ae8acf 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -11,7 +11,6 @@ INCLUDE (FindPkgConfig)
 project (piglit)
 
 find_package(TIFF)
-find_package(GLUT REQUIRED)
 find_package(X11)
 
 
@@ -45,6 +44,21 @@ if(PIGLIT_USE_WAFFLE)
         add_definitions(-DPIGLIT_USE_WAFFLE)
 	set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WAFFLE_CFLAGS}")
 	set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WAFFLE_CFLAGS}")
+else()
+	find_package(GLUT REQUIRED)
+	# The 'REQUIRED' above correctly produces an error for
+	# OpenGL and PNG, but there's a bug involving FindGLUT.cmake
+	# that fails to produce the error as of CMake 2.8.5.
+	#
+	# Instead, CMake keeps going and eventually spams
+	# the console with a message for every target that used
+	# e.g. the ${GLUT_INCLUDE_DIR} variable. So it
+	# prints a line for basically every single test in piglit.
+	#
+	# Work around the bug and error out quickly here instead.
+	if (NOT GLUT_FOUND)
+		message(FATAL_ERROR "GLUT library not found")
+	endif()
 endif(PIGLIT_USE_WAFFLE)
 
 if(PIGLIT_BUILD_GLES1_TESTS AND NOT PIGLIT_USE_WAFFLE)
@@ -77,20 +91,6 @@ IF(PIGLIT_BUILD_GLX_TESTS)
 	pkg_check_modules(GLPROTO REQUIRED glproto)
 ENDIF()
 
-# The 'REQUIRED' above correctly produces an error for
-# OpenGL, but there's a bug involving FindGLUT.cmake
-# that fails to produce the error as of CMake 2.8.5.
-#
-# Instead, CMake keeps going and eventually spams
-# the console with a message for every target that used
-# e.g. the ${GLUT_INCLUDE_DIR} variable. So it
-# prints a line for basically every single test in piglit.
-#
-# Work around the bug and error out quickly here instead.
-if (NOT GLUT_FOUND)
-	message(FATAL_ERROR "GLUT library not found")
-endif()
-
 # Check for presence of Python 2.6 or greater.
 foreach(python_cmd python2 python)
 	execute_process(
-- 
1.8.0



More information about the Piglit mailing list