Bug 158335

Summary: CMake rules for finding smbc_set_context don't work when samba is in a non-standard place
Product: [Frameworks and Libraries] kdelibs Reporter: Christopher Neufeld <kdebugs>
Component: generalAssignee: kdelibs bugs <kdelibs-bugs>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:

Description Christopher Neufeld 2008-02-24 16:24:42 UTC
Version:            (using Devel)
Installed from:    Compiled sources
Compiler:          gcc-4.2.2 Compiler compiled from gcc.gnu.org sources
OS:                Linux

When building kdelibs, it decides that I don't have smbc_set_context.  The reason is that it does not know where to look to find my samba include files.  The following patch in the kdelibs tree allows kdebase to notice that I do, in fact, have a library with the required symbol:

Index: cmake/modules/FindSamba.cmake
===================================================================
--- cmake/modules/FindSamba.cmake       (revision 778745)
+++ cmake/modules/FindSamba.cmake       (working copy)
@@ -29,6 +29,7 @@
    include(MacroPushRequiredVars)
    macro_push_required_vars()
    set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${SAMBA_LIBRARIES})
+   set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${SAMBA_INCLUDE_DIR})
    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
Comment 1 Christopher Neufeld 2008-02-24 16:26:13 UTC
OK, to clarify, kdelibs builds and installs, but later on, those packages that are interested in smbc_set_context (such as kdebase) decide that it isn't present.  This fix to kdelibs allows those packages to detect the presence of that symbol.
Comment 2 Christopher Neufeld 2008-02-24 17:03:50 UTC
Well, once kdebase knows it can use samba in a non-standard location, it needs a bit of CMake-related fixing also.  I'm going to do a complete rebuild to look for more problems.  For now, this appears to fix kdebase (but this is not from a clean rebuild):

Index: runtime/kioslave/smb/CMakeLists.txt
===================================================================
--- runtime/kioslave/smb/CMakeLists.txt (revision 778767)
+++ runtime/kioslave/smb/CMakeLists.txt (working copy)
@@ -8,6 +8,7 @@
    kio_smb_internal.cpp
    kio_smb_mount.cpp )

+include_directories(${SAMBA_INCLUDE_DIR})

 kde4_add_plugin(kio_smb ${kio_smb_PART_SRCS})

Comment 3 Christopher Neufeld 2008-02-24 18:41:09 UTC
With these two changes applied, did a clean build on all of:

kdesupport kdelibs kdepimlibs kdebase kdepim kdeaccessibility kdeadmin kdeartwork kdebindings kdeedu kdegames kdegraphics kdemultimedia kdenetwork kdesdk kdetoys kdeutils kdewebdev ktorrent kdevplatform kdevelop

All compiled correctly, save kdevelop, which failed with an unrelated error.  I do not have the ability to check in code, so I'd appreciate if somebody could apply these, after verifying their correctness.
Comment 4 Allen Winter 2008-02-27 21:49:05 UTC
SVN commit 780025 by winterz:

fix Samba discovery and usage
thanks for the patch Christopher.
BUGS: 158335


 M  +1 -0      kdebase/runtime/kioslave/smb/CMakeLists.txt  
 M  +1 -0      kdelibs/cmake/modules/FindSamba.cmake  


WebSVN link: http://websvn.kde.org/?view=rev&revision=780025