Hi Ankur,<div><br></div><div>May be you're just missing -devel or -dev pacakges on your system? They usually provide a symlink from .so to .so.X.Y to allow ld or gcc find the correct library.</div><div><br></div><div>Or do you really have multiple libraries versions installed simultaneously, each with headers?<br>
<br><div class="gmail_quote">On Thu, Mar 10, 2011 at 2:25 AM, Andreas Pakulat <span dir="ltr"><<a href="mailto:apaku@gmx.de">apaku@gmx.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">On 09.03.11 21:36:25, Ankur Handa wrote:<br>
> I'm using find_library to find a library in a given directory but it has<br>
> many different versions of this library listed as libcxcore.so,<br>
> libcxcore.so.2.1 and libcxcore.so.2.1.0 I wrote a very simple cmake file<br>
><br>
> cmake_minimum_required(VERSION 2.8)<br>
><br>
> find_library(OpenCV_LIBRARY_RELEASE NAMES "cxcore" PATHS<br>
> "/homes/ahanda/openCV2.1/OpenCV-2.1.0/opencvinstall/lib" NO_DEFAULT_PATH)<br>
><br>
> if ( OpenCV_LIBRARY_RELEASE)<br>
> message("LIBRARY FOUND = " ${OpenCV_LIBRARY_RELEASE})<br>
> endif()<br>
><br>
> if ( NOT OpenCV_LIBRARY_RELEASE)<br>
> message("LIBRARY NOT FOUND")<br>
> endif()<br>
><br>
> It works fine if I search for "cxcore" for which it returns me libcxcore.so<br>
> and the OpenCV_LIBRARY_RELEASE<br>
> as /homes/ahanda/openCV2.1/OpenCV-2.1.0/opencvinstall/lib/libcxcore.so<br>
><br>
> However if I try to search for cxcore21 or cxcore210 or even<br>
> libcxcore.so.2.1.0 it won't return me anything and I'd always see LIBRARY<br>
> NOT FOUND being printed.<br>
><br>
> Could anyone please let me know how to really search for libcxcore.so.2.1.0<br>
<br>
</div>You can't I think. Thats simply not how cmake or the linker work. The<br>
linker during the compilation phase will always link against<br>
lib<name>.so. So you need to make sure that your lib<name>.so is from<br>
cxcore 2.1.0 and search simply for cxcore.<br>
<br>
If you want to make sure that a user has at least cxcore 2.1.0 installed<br>
you'll need to use other means to find out the version number of the<br>
installed library. Usually such libs provide a header with version<br>
numbers which you can read. Or it may have a pkgconfig file for which<br>
cmake has extra macros to read them. In worst case you could try to grep<br>
for the version number in the output of strings running over the found<br>
library.<br>
<br>
Andreas<br>
<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br>
</blockquote></div><br></div>