From 1a972b43a91cb039239f23b82e8510e40401ef07 Mon Sep 17 00:00:00 2001 From: Jens Georg <jens.georg@desy.de> Date: Fri, 24 Jul 2020 14:56:54 +0200 Subject: [PATCH] FindDOOCS: More work-around for dev-libtine The pkg-config file is missing so we have to search for the library manually --- cmake/Modules/FindDOOCS.cmake | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/cmake/Modules/FindDOOCS.cmake b/cmake/Modules/FindDOOCS.cmake index e85049e..a267d7f 100644 --- a/cmake/Modules/FindDOOCS.cmake +++ b/cmake/Modules/FindDOOCS.cmake @@ -73,12 +73,26 @@ include(FindPkgConfig) if(DEFINED DOOCS_DIR) set(ENV{PKG_CONFIG_PATH} $ENV{PKG_CONFIG_PATH}:${DOOCS_DIR}/pkgconfig) endif() - -# Work-around for missing rpath on libDOOCSClient - explicitly link against libtine -list(APPEND DOOCS_FIND_COMPONENTS tinemt) +set(ENV{PKG_CONFIG_PATH} $ENV{PKG_CONFIG_PATH}:/export/doocs/lib/pkgconfig) +message("Using PKG_CONFIG_PATH=$ENV{PKG_CONFIG_PATH}") +pkg_check_modules(DOOCS REQUIRED ${DOOCS_FIND_COMPONENTS}) set(ENV{PKG_CONFIG_PATH} $ENV{PKG_CONFIG_PATH}:/export/doocs/lib/pkgconfig) message("Using PKG_CONFIG_PATH=$ENV{PKG_CONFIG_PATH}") + +# Work-around #1: Link explicitly against tinemt because libDOOCSapi links against it +# but we usually don't have $DOOCS_DIR in ld.so search path and the meson build process +# does not set a rpath (rt #979328) +# +# Work-around #2: dev-libtine is missing the pkg-config file so use find-library if +# pkg-config fails, otherwise append it to DOOCS_FIND_COMPONENTS (rt #979516) +pkg_check_modules(tinemt tinemt) +if(tinemt_FOUND) + list(APPEND DOOCS_FIND_COMPONENTS tinemt) +else() + find_library(TINEMTLIB tinemt REQUIRED) +endif() + pkg_check_modules(DOOCS REQUIRED ${DOOCS_FIND_COMPONENTS}) string(REPLACE ";" " " DOOCS_CFLAGS "${DOOCS_CFLAGS}") @@ -90,7 +104,7 @@ find_package(Threads REQUIRED) set(DOOCS_DIR "${DOOCS_doocs-doocsapi_LIBDIR}") set(DOOCS_VERSION "${DOOCS_doocs-doocsapi_VERSION}") set(DOOCS_CXX_FLAGS ${DOOCS_CFLAGS}) -set(DOOCS_LIBRARIES ${DOOCS_LDFLAGS} ${CMAKE_THREAD_LIBS_INIT}) +set(DOOCS_LIBRARIES ${DOOCS_LDFLAGS} ${CMAKE_THREAD_LIBS_INIT} ${TINEMTLIB}) set(DOOCS_LINKER_FLAGS "-Wl,--no-as-needed") set(DOOCS_LINK_FLAGS ${DOOCS_LINKER_FLAGS}) -- GitLab