From bfdbcdf7b2bb499d065966d7e1b06010ba0d77eb Mon Sep 17 00:00:00 2001
From: Martin <martin.killenberg@desy.de>
Date: Tue, 12 Jul 2016 10:50:08 +0200
Subject: [PATCH] use readelf instead of readlink to extract the DOOCS version
 and do not strip the system-dependent part of the version (e.g. -xenial1),
 since it is needed to identify the version correctly.

---
 cmake/Modules/FindDOOCS.cmake | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/cmake/Modules/FindDOOCS.cmake b/cmake/Modules/FindDOOCS.cmake
index 3694694..9955675 100644
--- a/cmake/Modules/FindDOOCS.cmake
+++ b/cmake/Modules/FindDOOCS.cmake
@@ -55,11 +55,11 @@ set(DOOCS_LINK_FLAGS "-Wl,--no-as-needed")
 
 # extract DOOCS version from librar so symlink. Note: This is platform dependent and only works
 # if DOOCS was installed from the Debian pagackes. Find a better version detection scheme!
-execute_process(COMMAND bash -c "readlink ${DOOCS_DIR}/libDOOCSapi.so | sed -e 's/^.*libDOOCSapi.so.//' -e 's/-.*$//'" OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE DOOCS_VERSION)
+execute_process(COMMAND bash -c "readelf -d ${DOOCS_DIR}/libDOOCSapi.so | grep SONAME | sed -e 's/^.*Library soname: \\[libDOOCSapi\\.so\\.//' -e 's/\\]$//'"
+                OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE DOOCS_VERSION)
 
 # use a macro provided by CMake to check if all the listed arguments are valid and set DOOCS_FOUND accordingly
 include(FindPackageHandleStandardArgs)
 FIND_PACKAGE_HANDLE_STANDARD_ARGS(DOOCS
         REQUIRED_VARS DOOCS_DIR
-	    VERSION_VAR DOOCS_VERSION )
-
+        VERSION_VAR DOOCS_VERSION )
-- 
GitLab