[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-buildsystem
Subject:    Re: Review Request 112448: FindSamba add PkgConfig fallback
From:       "Alexander Neundorf" <neundorf () kde ! org>
Date:       2013-09-08 9:08:33
Message-ID: 20130908090833.14140.13536 () vidsolbach ! de
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


> On Sept. 7, 2013, 8:48 p.m., Christophe Giboudeaux wrote:
> > cmake/modules/FindSamba.cmake, lines 24-30
> > <http://git.reviewboard.kde.org/r/112448/diff/1/?file=186323#file186323line24>
> > 
> > I recommend using PC_SAMBA_INCLUDEDIR and PC_SAMBA_LIBDIR as hints for the \
> > find_path / find_library calls instead 
> > eg:
> > if(NOT WIN32)
> > find_package(PkgConfig)
> > if(PKG_CONFIG_FOUND)
> > pkg_check_modules(PC_SAMBA smbclient)
> > endif()
> > endif()
> > 
> > find_path(SAMBA_INCLUDE_DIR NAMES libsmbclient.h HINTS ${PC_SAMBA_INCLUDEDIR})
> > 
> > find_library(SAMBA_LIBRARIES NAMES smbclient HINTS ${PC_SAMBA_LIBDIR})
> 
> Mark Gaiser wrote:
> While it certainly looks cleaner, isn't it a bit strange to do it like that? I \
> mean, it sounds so strange to let pkg-config search for samba and then fall back to \
> the other search stuff to again find samba..

The if(NOT WIN32) is not needed. If pkgconfig is not found, pkg_check_modules() \
simply does nothing.

Interesting point.
But I agree with Christophe. That way, i.e. use pkg-config to give hints to the \
actual find-calls, the result is in the same form in all cases, whether it has been \
found with or without pkg-config. I.e. the SAMBA_INCLUDE_DIR and SAMBA_LIBRARIES are \
cached cmake variables and can be edited by the user. When using pkg-config results \
directly, this is different.


- Alexander


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/112448/#review39550
-----------------------------------------------------------


On Sept. 2, 2013, 1:04 p.m., Mark Gaiser wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/112448/
> -----------------------------------------------------------
> 
> (Updated Sept. 2, 2013, 1:04 p.m.)
> 
> 
> Review request for Build System.
> 
> 
> Description
> -------
> 
> FindSamba couldn't find samba on my machine. Perhaps because it's Samba 4 and it's \
> include folder is /usr/include/samba-4.0/. However, "pkg-config --cflags-only-I \
> smbclient" worked just fine and returned the correct include path. This patch falls \
> back to pkg-config if it couldn't find samba. 
> 
> Diffs
> -----
> 
> cmake/modules/FindSamba.cmake c4df80f 
> 
> Diff: http://git.reviewboard.kde.org/r/112448/diff/
> 
> 
> Testing
> -------
> 
> Works, finds samba without issues.
> 
> 
> Thanks,
> 
> Mark Gaiser
> 
> 


[Attachment #5 (text/html)]

<html>
 <body>
  <div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
   <table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 \
solid;">  <tr>
     <td>
      This is an automatically generated e-mail. To reply, visit:
      <a href="http://git.reviewboard.kde.org/r/112448/">http://git.reviewboard.kde.org/r/112448/</a>
  </td>
    </tr>
   </table>
   <br />










<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;">  <p style="margin-top: 0;">On September 7th, 2013, 8:48 p.m. UTC, \
<b>Christophe Giboudeaux</b> wrote:</p>  <blockquote style="margin-left: 1em; \
border-left: 2px solid #d0d0d0; padding-left: 10px;">  



<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; \
border-collapse: collapse; margin: 2px padding: 2px;">  <thead>
  <tr>
   <th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; \
font-size: 9pt; padding: 4px 8px; text-align: left;">  <a \
href="http://git.reviewboard.kde.org/r/112448/diff/1/?file=186323#file186323line24" \
style="color: black; font-weight: bold; text-decoration: \
underline;">cmake/modules/FindSamba.cmake</a>  <span style="font-weight: normal;">

     (Diff revision 1)

    </span>
   </th>
  </tr>
 </thead>



 
 

 <tbody>

  <tr>
    <th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th>  <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>  <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">24</font></th>  <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span \
class="nb">if</span><span class="p">(</span><span class="s">NOT</span> <span \
class="s">SAMBA_INCLUDE_DIR</span> <span class="s">OR</span> <span \
class="s">NOT</span> <span class="s">SAMBA_LIBRARIES</span><span \
class="p">)</span></pre></td>  </tr>

  <tr>
    <th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th>  <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>  <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">25</font></th>  <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">   <span \
class="nb">find_package</span><span class="p">(</span><span \
class="s">PkgConfig</span><span class="p">)</span></pre></td>  </tr>

  <tr>
    <th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th>  <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>  <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">26</font></th>  <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">   <span \
class="nb">if</span><span class="p">(</span><span \
class="s">PKGCONFIG_FOUND</span><span class="p">)</span></pre></td>  </tr>

  <tr>
    <th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th>  <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>  <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">27</font></th>  <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">      <span \
class="nb">pkg_search_module</span><span class="p">(</span><span \
class="s">SAMBA</span> <span class="s">smbclient</span><span \
class="p">)</span></pre></td>  </tr>

  <tr>
    <th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th>  <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>  <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">28</font></th>  <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">      <span \
class="nb">set</span><span class="p">(</span><span class="s">SAMBA_INCLUDE_DIR</span> \
<span class="o">${</span><span class="nv">SAMBA_INCLUDE_DIRS</span><span \
class="o">}</span><span class="p">)</span></pre></td>  </tr>

  <tr>
    <th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th>  <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>  <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">29</font></th>  <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">   <span \
class="nb">endif</span><span class="p">(</span><span \
class="s">PKGCONFIG_FOUND</span><span class="p">)</span></pre></td>  </tr>

  <tr>
    <th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th>  <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>  <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">30</font></th>  <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span \
class="nb">endif</span><span class="p">(</span><span class="s">NOT</span> <span \
class="s">SAMBA_INCLUDE_DIR</span> <span class="s">OR</span> <span \
class="s">NOT</span> <span class="s">SAMBA_LIBRARIES</span><span \
class="p">)</span></pre></td>  </tr>

 </tbody>

</table>

  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">I recommend using \
PC_SAMBA_INCLUDEDIR and PC_SAMBA_LIBDIR as hints for the find_path / find_library \
calls instead

eg:
if(NOT WIN32)
  find_package(PkgConfig)
  if(PKG_CONFIG_FOUND)
    pkg_check_modules(PC_SAMBA smbclient)
  endif()
endif()

find_path(SAMBA_INCLUDE_DIR NAMES libsmbclient.h HINTS ${PC_SAMBA_INCLUDEDIR})

find_library(SAMBA_LIBRARIES NAMES smbclient HINTS ${PC_SAMBA_LIBDIR})</pre>
 </blockquote>



 <p>On September 8th, 2013, 12:01 a.m. UTC, <b>Mark Gaiser</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;">  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">While it certainly looks \
cleaner, isn&#39;t it a bit strange to do it like that? I mean, it sounds so strange \
to let pkg-config search for samba and then fall back to the other search stuff to \
again find samba..</pre>  </blockquote>







</blockquote>
<pre style="margin-left: 1em; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">The if(NOT \
WIN32) is not needed. If pkgconfig is not found, pkg_check_modules() simply does \
nothing.

Interesting point.
But I agree with Christophe. That way, i.e. use pkg-config to give hints to the \
actual find-calls, the result is in the same form in all cases, whether it has been \
found with or without pkg-config. I.e. the SAMBA_INCLUDE_DIR and SAMBA_LIBRARIES are \
cached cmake variables and can be edited by the user. When using pkg-config results \
directly, this is different.</pre> <br />




<p>- Alexander</p>


<br />
<p>On September 2nd, 2013, 1:04 p.m. UTC, Mark Gaiser wrote:</p>








<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" \
style="background-image: \
url('http://git.reviewboard.kde.org/static/rb/images/review_request_box_top_bg.ab6f3b1072c9.png'); \
background-position: left top; background-repeat: repeat-x; border: 1px black \
solid;">  <tr>
  <td>

<div>Review request for Build System.</div>
<div>By Mark Gaiser.</div>


<p style="color: grey;"><i>Updated Sept. 2, 2013, 1:04 p.m.</i></p>






<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
 <table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" \
style="border: 1px solid #b8b5a0">  <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">FindSamba couldn&#39;t find samba on my machine. Perhaps because \
it&#39;s Samba 4 and it&#39;s include folder is /usr/include/samba-4.0/. However, \
&quot;pkg-config --cflags-only-I smbclient&quot; worked just fine and returned the \
correct include path. This patch falls back to pkg-config if it couldn&#39;t find \
samba.</pre>  </td>
 </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: \
1px solid #b8b5a0">  <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">Works, finds samba without issues.</pre>  </td>
 </tr>
</table>




<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">

 <li>cmake/modules/FindSamba.cmake <span style="color: grey">(c4df80f)</span></li>

</ul>

<p><a href="http://git.reviewboard.kde.org/r/112448/diff/" style="margin-left: \
3em;">View Diff</a></p>







  </td>
 </tr>
</table>








  </div>
 </body>
</html>



_______________________________________________
Kde-buildsystem mailing list
Kde-buildsystem@kde.org
https://mail.kde.org/mailman/listinfo/kde-buildsystem


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic