aboutsummaryrefslogtreecommitdiff
path: root/cmake/modules/FindBluray.cmake
diff options
context:
space:
mode:
authorwsnipex <wsnipex@a1.net>2017-07-24 13:57:26 +0200
committerwsnipex <wsnipex@a1.net>2017-07-24 15:22:31 +0200
commite7737a696dda171f789314bc289f4d302f80d7da (patch)
tree4d9dafefc13c72dd680e6ef77cfd202f70f3cdf9 /cmake/modules/FindBluray.cmake
parent4e86ad6bbb095df5aad3c677419d270e6f70bf3c (diff)
[cmake] FindBluray.cmake: fix version check
Diffstat (limited to 'cmake/modules/FindBluray.cmake')
-rw-r--r--cmake/modules/FindBluray.cmake13
1 files changed, 10 insertions, 3 deletions
diff --git a/cmake/modules/FindBluray.cmake b/cmake/modules/FindBluray.cmake
index 9e5bf08673..010fdf1bf7 100644
--- a/cmake/modules/FindBluray.cmake
+++ b/cmake/modules/FindBluray.cmake
@@ -14,14 +14,21 @@
#
# Bluray::Bluray - The libbluray library
+set(Bluray_FIND_VERSION 0.9.3)
if(PKG_CONFIG_FOUND)
- pkg_check_modules(PC_BLURAY libbluray>=0.9.3 QUIET)
+ pkg_check_modules(PC_BLURAY libbluray>=${Bluray_FIND_VERSION} QUIET)
+ set(BLURAY_VERSION ${PC_BLURAY_VERSION})
endif()
find_path(BLURAY_INCLUDE_DIR libbluray/bluray.h
PATHS ${PC_BLURAY_INCLUDEDIR})
-set(BLURAY_VERSION ${PC_BLURAY_VERSION})
+if(NOT BLURAY_VERSION AND EXISTS ${BLURAY_INCLUDE_DIR}/libbluray/bluray-version.h)
+ file(STRINGS ${BLURAY_INCLUDE_DIR}/libbluray/bluray-version.h _bluray_version_str
+ REGEX "#define[ \t]BLURAY_VERSION_STRING[ \t][\"]?[0-9.]+[\"]?")
+ string(REGEX REPLACE "^.*BLURAY_VERSION_STRING[ \t][\"]?([0-9.]+).*$" "\\1" BLURAY_VERSION ${_bluray_version_str})
+ unset(_bluray_version_str)
+endif()
include(FindPackageHandleStandardArgs)
if(NOT WIN32)
@@ -29,7 +36,7 @@ if(NOT WIN32)
PATHS ${PC_BLURAY_LIBDIR})
find_package_handle_standard_args(Bluray
- REQUIRED_VARS BLURAY_LIBRARY BLURAY_INCLUDE_DIR
+ REQUIRED_VARS BLURAY_LIBRARY BLURAY_INCLUDE_DIR BLURAY_VERSION
VERSION_VAR BLURAY_VERSION)
else()
# Dynamically loaded DLL