From 07acb405620ec881bd2c8c137e86a417a40bf14b Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Mon, 25 Jun 2007 12:48:39 +0000 Subject: needed outside kdebase/workspace, so move them to kdelibs svn path=/trunk/KDE/kdelibs/; revision=680109 --- modules/FindSamba.cmake | 56 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 modules/FindSamba.cmake (limited to 'modules/FindSamba.cmake') diff --git a/modules/FindSamba.cmake b/modules/FindSamba.cmake new file mode 100644 index 00000000..08c0fee3 --- /dev/null +++ b/modules/FindSamba.cmake @@ -0,0 +1,56 @@ +# - Try to find the samba directory library +# Once done this will define +# +# SAMBA_FOUND - system has SAMBA +# SAMBA_INCLUDE_DIR - the SAMBA include directory +# SAMBA_LIBRARIES - The libraries needed to use SAMBA +# Set SAMBA_REQUIRE_SMBC_SET_CONTEXT to TRUE if you need a version of Samba +# which comes with smbc_set_context() + +# Copyright (c) 2006, Alexander Neundorf, +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + +if(SAMBA_INCLUDE_DIR AND SAMBA_LIBRARIES) + # Already in cache, be silent + set(Samba_FIND_QUIETLY TRUE) +endif(SAMBA_INCLUDE_DIR AND SAMBA_LIBRARIES) + +find_path(SAMBA_INCLUDE_DIR NAMES libsmbclient.h ) + +find_library(SAMBA_LIBRARIES NAMES smbclient ) + + +if(SAMBA_INCLUDE_DIR AND SAMBA_LIBRARIES) + set(SAMBA_FOUND TRUE) + # check whether libsmbclient has smbc_set_context() + include(CheckSymbolExists) + include(MacroPushRequiredVars) + macro_push_required_vars() + set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${SAMBA_LIBRARIES}) + check_symbol_exists(smbc_set_context "libsmbclient.h" SAMBA_HAVE_SMBC_SET_CONTEXT) + macro_pop_required_vars() + # fail if smbc_set_context() was required but hasn't been found + if (SAMBA_REQUIRE_SMBC_SET_CONTEXT AND NOT SAMBA_HAVE_SMBC_SET_CONTEXT) + set(SAMBA_FOUND FALSE) + endif (SAMBA_REQUIRE_SMBC_SET_CONTEXT AND NOT SAMBA_HAVE_SMBC_SET_CONTEXT) + +else(SAMBA_INCLUDE_DIR AND SAMBA_LIBRARIES) + set(SAMBA_FOUND FALSE) + set(SAMBA_HAVE_SMBC_SET_CONTEXT FALSE) +endif(SAMBA_INCLUDE_DIR AND SAMBA_LIBRARIES) + + +if(SAMBA_FOUND) + if(NOT Samba_FIND_QUIETLY) + message(STATUS "Found samba: ${SAMBA_LIBRARIES}") + endif(NOT Samba_FIND_QUIETLY) +else(SAMBA_FOUND) + if (Samba_FIND_REQUIRED) + message(FATAL_ERROR "Could not find Samba library") + endif (Samba_FIND_REQUIRED) +endif(SAMBA_FOUND) + +mark_as_advanced(SAMBA_INCLUDE_DIR SAMBA_LIBRARIES) + -- cgit v1.2.1