From 0e1198064e6f95724d7bc92cc9ef14eb8a37e245 Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Fri, 30 Oct 2020 17:07:52 +0100 Subject: [PATCH] cmake: fix libsasl linking --- src/libmemcached/CMakeLists.txt | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/libmemcached/CMakeLists.txt b/src/libmemcached/CMakeLists.txt index d51295d5..6ed96a88 100644 --- a/src/libmemcached/CMakeLists.txt +++ b/src/libmemcached/CMakeLists.txt @@ -91,11 +91,13 @@ set_target_properties(libmemcached PROPERTIES VERSION v${LIBMEMCACHED_VERSION}) target_compile_definitions(libmemcached PRIVATE -DBUILDING_LIBMEMCACHED) target_link_libraries(libmemcached PUBLIC libhashkit Threads::Threads ${LIBSASL_LIBRARIES} ${CMAKE_DL_LIBS} ${Backtrace_LIBRARIES}) -if(PKG_CONFIG_FOUND) - target_link_libraries(libmemcached PUBLIC libhashkit PkgConfig::LIBSASL) -else() - target_link_libraries(libmemcached PUBLIC ${LIBSASL_LIBRARIES}) - target_include_directories(libmemcached PUBLIC ${LIBSASL_INCLUDEDIR}) +if(LIBSASL_FOUND) + if(PKG_CONFIG_FOUND) + target_link_libraries(libmemcached PUBLIC PkgConfig::LIBSASL) + else() + target_link_libraries(libmemcached PUBLIC ${LIBSASL_LIBRARIES}) + target_include_directories(libmemcached PUBLIC ${LIBSASL_INCLUDEDIR}) + endif() endif() target_include_directories(libmemcached PRIVATE ${Backtrace_INCLUDE_DIR}) target_include_directories(libmemcached PRIVATE -- 2.30.2