Commit 6fb98d62 authored by Dylan Baker's avatar Dylan Baker Committed by Chad Versace

cmake: fix version search

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 #27: https://github.com/waffle-gl/waffle/issues/27Signed-off-by: default avatarDylan Baker <dylanx.c.baker@intel.com>
Reviewed-by: Jordan Justen's avatarJordan Justen <jordan.l.justen@intel.com>
Reviewed-by: default avatarChad Versace <chad.versace@intel.com>
parent 222e44b7
......@@ -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)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment