From: Dylan Baker <[email protected]>

This patch changes the behavior find_pkg for waffle to use a config file
pkg-config.

Config files are like pkgconfig files, but instead of being a linux
specific solution they are a cmake specific solution.
---
 CMakeLists.txt            | 37 +------------------------------------
 tests/util/CMakeLists.txt |  2 +-
 2 files changed, 2 insertions(+), 37 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8cf046d..7944ac1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -42,42 +42,7 @@ else()
 endif()
 
 if(PIGLIT_USE_WAFFLE)
-       if (NOT WIN32)
-               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()
-
-               # 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.5.0")
-               if(Waffle_VERSION VERSION_LESS Waffle_REQUIRED_VERSION)
-                       message(FATAL_ERROR "Found waffle-${Waffle_VERSION}, 
but "
-                       "piglit requires waffle-${Waffle_REQUIRED_VERSION}")
-               endif()
-       else ()
-               find_path(Waffle_INCLUDE_DIRS waffle.h)
-        find_library(Waffle_LIBRARIES waffle-1)
-               if(Waffle_INCLUDE_DIRS AND Waffle_LIBRARIES)
-                       set(Waffle_FOUND TRUE)
-               else()
-                       message(FATAL_ERROR "Failed to find Waffle. Get and 
build Waffle from "
-                               "http://www.waffle-gl.org and set 
Waffle_INCLUDE_DIRS and "
-                               "Waffle_LIBRARIES variables accordingly."
-                       )
-               endif()
-       endif ()
-
+    find_package(Waffle 1.5.0 CONFIG REQUIRED)
        add_definitions(-DPIGLIT_USE_WAFFLE)
        add_definitions(-DWAFFLE_API_VERSION=0x0103)
 else()
diff --git a/tests/util/CMakeLists.txt b/tests/util/CMakeLists.txt
index d1141bf..680b9f5 100644
--- a/tests/util/CMakeLists.txt
+++ b/tests/util/CMakeLists.txt
@@ -29,7 +29,7 @@ set(UTIL_GL_INCLUDES
        ${UTIL_INCLUDES}
        ${GLEXT_INCLUDE_DIR}
        ${OPENGL_INCLUDE_PATH}
-       ${Waffle_INCLUDE_DIRS}
+    ${Waffle_INCLUDE_DIRS}
        )
 
 set(UTIL_GL_SOURCES
-- 
2.2.1

_______________________________________________
Piglit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to