[Piglit] [Patch v2 3/3] CMakeLists.txt: Use FindWaffle.cmake instead of pkg-find

Dylan Baker baker.dylan.c at gmail.com
Mon Dec 15 10:56:48 PST 2014


This is nice because it should work on both windows and on linux, since
FindWaffle is provided by waffle itself.

This is tested on Linux, but not on Windows.

NOTE: There is a bug in FindWaffle.cmake that causes it to never check
that the requested version is present. There is a patch on the waffle
list for this problem.

Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
---
 CMakeLists.txt | 26 +-------------------------
 1 file changed, 1 insertion(+), 25 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index e85bb37..200dbbf 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -42,31 +42,7 @@ else()
 endif()
 
 if(PIGLIT_USE_WAFFLE)
-	if (NOT MSVC)
-		pkg_check_modules(WAFFLE REQUIRED waffle-1)
-
-		if(NOT WAFFLE_FOUND)
-			message(FATAL_ERROR "Failed to find Waffle. If Waffle"
-			"is not packaged for your distribution, you can get "
-			"it at http://www.waffle-gl.org."
-		)
-		endif()
-	endif ()
-
-	# Check the installed waffle version.
-	#
-	# We cannot reliably check the version with pkg_check_modules(), but
-	# instead must check the version manually as below. The problem is that,
-	# if one passes a required version to pkg_check_modules(), CMake
-	# validates the required version at most once for the lifetime of the
-	# source tree.  If someone changes the required version by editing the
-	# CMakeLists, CMake fails to detect the new requirement.
-	set(WAFFLE_REQUIRED_VERSION "1.3.0")
-	if(WAFFLE_VERSION VERSION_LESS WAFFLE_REQUIRED_VERSION)
-		message(FATAL_ERROR "Found waffle-${WAFFLE_VERSION}, but "
-		"piglit requires waffle-${WAFFLE_REQUIRED_VERSION}")
-	endif()
-
+	find_package(Waffle, 1.3.0 REQUIRED)
 	add_definitions(-DPIGLIT_USE_WAFFLE)
 	add_definitions(-DWAFFLE_API_VERSION=0x0103)
 else()
-- 
2.2.0



More information about the Piglit mailing list