From 5fd95c63473fc31bc70217443f9ece515e5b1d7f Mon Sep 17 00:00:00 2001
From: Martin Hierholzer <martin.hierholzer@desy.de>
Date: Wed, 14 Sep 2016 18:00:55 +0200
Subject: [PATCH] added option to include the zqm library (to be tested)

---
 cmake/Modules/FindDOOCS.cmake | 26 +++++++++++++++++---------
 1 file changed, 17 insertions(+), 9 deletions(-)

diff --git a/cmake/Modules/FindDOOCS.cmake b/cmake/Modules/FindDOOCS.cmake
index 9955675..a59396e 100644
--- a/cmake/Modules/FindDOOCS.cmake
+++ b/cmake/Modules/FindDOOCS.cmake
@@ -3,7 +3,7 @@
 # cmake module for finding DOOCS
 #
 # By default, only the client API is included. If the component "server" is specified, also the
-# server library will be used.
+# server library will be used. If the component "zmq" is specified, the DOOCSdzmq library will be used as well.
 #
 # returns:
 #   DOOCS_FOUND        : true or false, depending on whether the package was found
@@ -32,18 +32,26 @@
 
 SET(DOOCS_FOUND 0)
 
-if("${DOOCS_FIND_COMPONENTS}" STREQUAL "server")
+FIND_PATH(DOOCS_DIR libDOOCSapi.so
+  ${CMAKE_CURRENT_LIST_DIR}
+  /export/doocs/lib
+)
+set(DOOCS_LIBRARIES DOOCSapi nsl dl pthread m rt ldap)
+
+if (";${DOOCS_FIND_COMPONENTS};" MATCHES ";server;")
   FIND_PATH(DOOCS_DIR libEqServer.so
     ${CMAKE_CURRENT_LIST_DIR}
     /export/doocs/lib
   )
-  set(DOOCS_LIBRARIES EqServer DOOCSapi nsl dl pthread m rt ldap)
-else()
-  FIND_PATH(DOOCS_DIR libDOOCSapi.so
+  set(DOOCS_LIBRARIES ${DOOCS_LIBRARIES} EqServer)
+endif()
+
+if (";${DOOCS_FIND_COMPONENTS};" MATCHES ";zmq;")
+  FIND_PATH(DOOCS_DIR libDOOCSdzmq.so
     ${CMAKE_CURRENT_LIST_DIR}
     /export/doocs/lib
   )
-  set(DOOCS_LIBRARIES DOOCSapi nsl dl pthread m rt ldap)
+  set(DOOCS_LIBRARIES ${DOOCS_LIBRARIES} DOOCSdzmq)
 endif()
 
 # now set the required variables based on the determined DOOCS_DIR
@@ -55,11 +63,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 "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)
+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)
 
 # 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