[waffle] [Patch v3 1/3] cmake: fix version search

Dylan Baker baker.dylan.c at gmail.com
Mon Dec 29 09:36:51 PST 2014


Currently the cmake file uses both WAFFLE_INCLUDE_DIR and
WAFFLE_INCLUDE_DIRS, but only the DIRS version is actually defined.
cmake doesn't complain about the undefined variable, instead it treats
it as a blank string. This leads to the version never being checked.

This patch replaces DIR with DIRS, which corrects the problem.

Fixes: https://github.com/waffle-gl/waffle/issues/27
Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen at intel.com>
---
 cmake/Modules/FindWaffle.cmake | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/cmake/Modules/FindWaffle.cmake b/cmake/Modules/FindWaffle.cmake
index 972bdfe..4e16c4e 100644
--- a/cmake/Modules/FindWaffle.cmake
+++ b/cmake/Modules/FindWaffle.cmake
@@ -48,8 +48,8 @@ find_library(WAFFLE_LIBRARIES
     NAMES "waffle-${WAFFLE_FIND_VERSION_MAJOR}"
 )
 
-if(WAFFLE_INCLUDE_DIR AND EXISTS "${WAFFLE_INCLUDE_DIR}/waffle_version.h")
-    file(STRINGS "${WAFFLE_INCLUDE_DIR}/waffle_version.h" WAFFLE_VERSION_H)
+if(WAFFLE_INCLUDE_DIRS AND EXISTS "${WAFFLE_INCLUDE_DIRS}/waffle_version.h")
+    file(STRINGS "${WAFFLE_INCLUDE_DIRS}/waffle_version.h" WAFFLE_VERSION_H)
     string(REGEX REPLACE "^.*WAFFLE_MAJOR_VERSION ([0-9]+).*$" "\\1" WAFFLE_MAJOR_VERSION "${WAFFLE_VERSION_H}")
     string(REGEX REPLACE "^.*WAFFLE_MINOR_VERSION ([0-9]+).*$" "\\1" WAFFLE_MINOR_VERSION "${WAFFLE_VERSION_H}")
     string(REGEX REPLACE "^.*WAFFLE_PATCH_VERSION ([0-9]+).*$" "\\1" WAFFLE_PATCH_VERSION "${WAFFLE_VERSION_H}")
@@ -72,9 +72,7 @@ mark_as_advanced(WAFFLE_LIBRARIES WAFFLE_INCLUDE_DIRS)
 # variables from the cache *and* local scope.
 #
 unset(WAFFLE_FIND_VERSION_MAJOR CACHE)
-unset(WAFFLE_INCLUDE_DIR CACHE)
 unset(WAFFLE_VERSION_H CACHE)
 
 unset(WAFFLE_FIND_VERSION_MAJOR)
-unset(WAFFLE_INCLUDE_DIR)
 unset(WAFFLE_VERSION_H)
-- 
2.2.1



More information about the waffle mailing list