[waffle] [PATCH] RFC: add FindWAFFLE.cmake

groleo at gmail.com groleo at gmail.com
Wed Oct 17 10:31:21 PDT 2012


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

Problem:
piglit searches waffle by using pkg_check_modules.
If one tried to use cmake and android toghether,
waffle won't be found, since pkg_check_modules relies on
pkg-config(missing on android)

Proposed fix:
add a Module file so that find_package can be used
instead of pkg_check_modules.

Signed-off-by: Adrian Marius Negreanu <adrian.m.negreanu at intel.com>
---
 cmake/Modules/FindWAFFLE.cmake | 48 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)
 create mode 100644 cmake/Modules/FindWAFFLE.cmake

diff --git a/cmake/Modules/FindWAFFLE.cmake b/cmake/Modules/FindWAFFLE.cmake
new file mode 100644
index 0000000..91c9332
--- /dev/null
+++ b/cmake/Modules/FindWAFFLE.cmake
@@ -0,0 +1,48 @@
+# - Find the native WAFFLE includes and library
+#
+# This module searches libpng, the library for working with WAFFLE images.
+#
+# It defines the following variables
+#  WAFFLE_INCLUDE_DIRS, where to find png.h, etc.
+#  WAFFLE_LIBRARIES, the libraries to link against to use WAFFLE.
+#  WAFFLE_DEFINITIONS - You should add_definitons(${WAFFLE_DEFINITIONS}) before compiling code that includes png library files.
+#  WAFFLE_FOUND, If false, do not try to use WAFFLE.
+# Also defined, but not for general use are
+#  WAFFLE_LIBRARY, where to find the WAFFLE library.
+# For backward compatiblity the variable WAFFLE_INCLUDE_DIR is also set. It has the same value as WAFFLE_INCLUDE_DIRS.
+#
+# Since WAFFLE depends on the ZLib compression library, none of the above will be
+# defined unless ZLib can be found.
+
+#=============================================================================
+# Copyright 2002-2009 Kitware, Inc.
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+#  License text for the above reference.)
+
+  find_path(WAFFLE_WAFFLE_INCLUDE_DIR waffle.h)
+
+  set(WAFFLE_NAMES ${WAFFLE_NAMES} waffle)
+  find_library(WAFFLE_LIBRARY NAMES ${WAFFLE_NAMES} )
+
+  if (WAFFLE_LIBRARY AND WAFFLE_WAFFLE_INCLUDE_DIR)
+      SET(WAFFLE_INCLUDE_DIRS ${WAFFLE_WAFFLE_INCLUDE_DIR})
+      SET(WAFFLE_INCLUDE_DIR ${WAFFLE_INCLUDE_DIRS} ) # for backward compatiblity
+      SET(WAFFLE_LIBRARIES ${WAFFLE_LIBRARY})
+
+  endif (WAFFLE_LIBRARY AND WAFFLE_WAFFLE_INCLUDE_DIR)
+
+
+# handle the QUIETLY and REQUIRED arguments and set WAFFLE_FOUND to TRUE if
+# all listed variables are TRUE
+include(/usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake)
+find_package_handle_standard_args(WAFFLE  DEFAULT_MSG  WAFFLE_LIBRARY WAFFLE_WAFFLE_INCLUDE_DIR)
+
+mark_as_advanced(WAFFLE_WAFFLE_INCLUDE_DIR WAFFLE_LIBRARY )
-- 
1.7.11.3



More information about the waffle mailing list