summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorChad Versace <chad.versace@linux.intel.com>2012-11-01 17:06:54 -0700
committerChad Versace <chad.versace@linux.intel.com>2012-11-01 17:34:19 -0700
commit0f781b300067a15a24587a937c437f49c17e0604 (patch)
tree06f226a41bdfa0e550252a6f180eeaa551f93cd2 /cmake
parente1a9401f1416dc7596e0acaaa201893a51eae57d (diff)
cmake/FindWaffle: Rename exported vars to follow CMake standards
The file /usr/share/cmake/Modules/readme.txt discusses standards for FindXXX.cmake files. This patch renames WAFFLE_INCLUDE_DIR -> WAFFLE_INCLUDE_DIRS WAFFLE_LIBRARY -> WAFFLE_LIBRARIES Not only does this change make FindWaffle standard conformat, it also conveniently transforms it to have the same behavior as calling the PkgConfig module with pkg_check_modules(WAFFLE waffle-1). Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/Modules/FindWaffle.cmake22
1 files changed, 17 insertions, 5 deletions
diff --git a/cmake/Modules/FindWaffle.cmake b/cmake/Modules/FindWaffle.cmake
index 35118ff..49d20aa 100644
--- a/cmake/Modules/FindWaffle.cmake
+++ b/cmake/Modules/FindWaffle.cmake
@@ -1,7 +1,7 @@
# - Locate the Waffle library and headers.
# This module defines the following variables:
-# WAFFLE_INCLUDE_DIR Full path to directory of the main Waffle header, waffle.h.
-# WAFFLE_LIBRARY Full path to the Waffle library.
+# WAFFLE_INCLUDE_DIRS Full path to directory of the main Waffle header, waffle.h.
+# WAFFLE_LIBRARIES Full path to the Waffle library.
# WAFFLE_FOUND True if Waffle was found.
# WAFFLE_VERSION_STRING Waffle's version in form "Major.Minor.Patch".
@@ -45,7 +45,10 @@ find_path(WAFFLE_PREFIX_INCLUDE_DIR
set(WAFFLE_INCLUDE_DIR "${WAFFLE_PREFIX_INCLUDE_DIR}/waffle-${WAFFLE_FIND_VERSION_MAJOR}")
-find_library(WAFFLE_LIBRARY
+set(WAFFLE_INCLUDE_DIRS "${WAFFLE_INCLUDE_DIR}"
+ CACHE FILEPATH "Full path to Waffle library")
+
+find_library(WAFFLE_LIBRARIES
NAMES "waffle-${WAFFLE_FIND_VERSION_MAJOR}"
)
@@ -61,12 +64,21 @@ endif()
# set 'WAFFLE_FOUND' to TRUE if all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
find_package_handle_standard_args(Waffle
- REQUIRED_VARS WAFFLE_LIBRARY WAFFLE_INCLUDE_DIR
+ REQUIRED_VARS WAFFLE_LIBRARIES WAFFLE_INCLUDE_DIRS
VERSION_VAR WAFFLE_VERSION_STRING
)
-mark_as_advanced(WAFFLE_LIBRARY WAFFLE_INCLUDE_DIR)
+mark_as_advanced(WAFFLE_LIBRARIES WAFFLE_INCLUDE_DIRS)
# Don't expose these variables.
+#
+# Some were set in the cache and some were not. To be safe, remove the
+# variables from the cache *and* local scope.
+#
unset(WAFFLE_FIND_VERSION_MAJOR CACHE)
+unset(WAFFLE_INCLUDE_DIR CACHE)
unset(WAFFLE_PREFIX_INCLUDE_DIR CACHE)
+
+unset(WAFFLE_FIND_VERSION_MAJOR)
+unset(WAFFLE_INCLUDE_DIR)
+unset(WAFFLE_PREFIX_INCLUDE_DIR)