Skip to content
Snippets Groups Projects
Commit e2870a15 authored by Martin Christoph Hierholzer's avatar Martin Christoph Hierholzer
Browse files

Merge remote-tracking branch 'project-template/master'

parents e4f5f9ee 9c2ac572
No related branches found
No related tags found
No related merge requests found
#
# 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.
#
# returns:
# DOOCS_FOUND : true or false, depending on whether the package was found
# DOOCS_VERSION : the package version
# DOOCS_INCLUDE_DIRS : path to the include directory
# DOOCS_LIBRARY_DIRS : path to the library directory
# DOOCS_LIBRARIES : list of libraries to link against
# DOOCS_CXX_FLAGS : Flags needed to be passed to the c++ compiler
# DOOCS_LINK_FLAGS : Flags needed to be passed to the linker
#
# @author Martin Hierholzer, DESY
#
SET(DOOCS_FOUND 0)
if("${DOOCS_FIND_COMPONENTS}" STREQUAL "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
${CMAKE_CURRENT_LIST_DIR}
/export/doocs/lib
)
set(DOOCS_LIBRARIES DOOCSapi nsl dl pthread m rt ldap)
endif()
# now set the required variables based on the determined DOOCS_DIR
set(DOOCS_INCLUDE_DIRS ${DOOCS_DIR}/include)
set(DOOCS_LIBRARY_DIRS ${DOOCS_DIR}/)
set(DOOCS_CXX_FLAGS "-Wall -fPIC -D_REENTRANT -DLINUX -D__LINUX__ -DDMSG")
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)
# 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 )
......@@ -34,15 +34,6 @@ foreach(LIBRARY ${LIST})
set(${PROJECT_NAME}_LINKER_FLAGS_MAKEFILE "${${PROJECT_NAME}_LINKER_FLAGS_MAKEFILE} -l${LIBRARY}")
endforeach()
# force the lists to be space separated (may be sometimes semicolon separated)
string(REPLACE ";" " " ${PROJECT_NAME}_SOVERSION ${${PROJECT_NAME}_SOVERSION})
string(REPLACE ";" " " ${PROJECT_NAME}_INCLUDE_DIRS ${${PROJECT_NAME}_INCLUDE_DIRS})
string(REPLACE ";" " " ${PROJECT_NAME}_LIBRARY_DIRS ${${PROJECT_NAME}_LIBRARY_DIRS})
string(REPLACE ";" " " ${PROJECT_NAME}_LIBRARIES ${${PROJECT_NAME}_LIBRARIES})
string(REPLACE ";" " " ${PROJECT_NAME}_CXX_FLAGS ${${PROJECT_NAME}_CXX_FLAGS})
string(REPLACE ";" " " ${PROJECT_NAME}_LINKER_FLAGS ${${PROJECT_NAME}_LINKER_FLAGS})
string(REPLACE ";" " " ${PROJECT_NAME}_MEXFLAGS ${${PROJECT_NAME}_MEXFLAGS})
# we have nested @-statements, so we have to parse twice:
# create the cmake Find package script
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment