From aaeae76bc3e5fa02601608bae85cdd1478843678 Mon Sep 17 00:00:00 2001 From: Rex Dieter Date: Sat, 6 Apr 2013 05:10:39 -0500 Subject: [PATCH] FindSamba.cmake: help find samba4 more reliably add PATH_SUFFIXES samba-4.0 and pkgconfig hints --- cmake/modules/FindSamba.cmake | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/cmake/modules/FindSamba.cmake b/cmake/modules/FindSamba.cmake index 16522c6..ec1179d 100644 --- a/cmake/modules/FindSamba.cmake +++ b/cmake/modules/FindSamba.cmake @@ -17,10 +17,20 @@ if(SAMBA_INCLUDE_DIR AND SAMBA_LIBRARIES) set(Samba_FIND_QUIETLY TRUE) endif(SAMBA_INCLUDE_DIR AND SAMBA_LIBRARIES) -find_path(SAMBA_INCLUDE_DIR NAMES libsmbclient.h ) +# use pkg-config to get the directories and then use these values +# in the FIND_PATH() and FIND_LIBRARY() calls +find_package(PkgConfig) +pkg_check_modules(PC_LIBSMBCLIENT QUIET smbclient) -find_library(SAMBA_LIBRARIES NAMES smbclient ) +find_path(SAMBA_INCLUDE_DIR NAMES libsmbclient.h PATH_SUFFIXES samba-4.0 + HINTS + ${PC_LIBSMBCLIENT_INCLUDEDIR} + ${PC_LIBSMBCLIENT_INCLUDE_DIRS}) +find_library(SAMBA_LIBRARIES NAMES smbclient + HINTS + ${PC_LIBSMBCLIENT_LIBDIR} + ${PC_LIBSMBCLIENT_LIB_DIRS}) if(SAMBA_INCLUDE_DIR AND SAMBA_LIBRARIES) set(SAMBA_FOUND TRUE) -- 1.8.1.4