cmake: fix libsasl linking
authorMichael Wallner <mike@php.net>
Fri, 30 Oct 2020 16:07:52 +0000 (17:07 +0100)
committerMichael Wallner <mike@php.net>
Fri, 30 Oct 2020 16:07:52 +0000 (17:07 +0100)
src/libmemcached/CMakeLists.txt

index d51295d574ce1e4daf6cd76cea578d79fef72ff4..6ed96a88bc7208bc1d989c99f1fdf69a378802b0 100644 (file)
@@ -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