[CMake] Find Library would not find the library

Ankur Handa handa.ankur at gmail.com
Wed Mar 9 16:36:25 EST 2011


Hi everyone,

I'm using find_library to find a library in a given directory but it has
many different versions of this library listed as libcxcore.so,
libcxcore.so.2.1 and libcxcore.so.2.1.0  I wrote a very simple cmake file

cmake_minimum_required(VERSION 2.8)

find_library(OpenCV_LIBRARY_RELEASE NAMES "cxcore" PATHS
"/homes/ahanda/openCV2.1/OpenCV-2.1.0/opencvinstall/lib" NO_DEFAULT_PATH)

if ( OpenCV_LIBRARY_RELEASE)
        message("LIBRARY FOUND = " ${OpenCV_LIBRARY_RELEASE})
endif()

if ( NOT OpenCV_LIBRARY_RELEASE)
        message("LIBRARY NOT FOUND")
endif()

It works fine if I search for "cxcore" for which it returns me libcxcore.so
and the OpenCV_LIBRARY_RELEASE
as /homes/ahanda/openCV2.1/OpenCV-2.1.0/opencvinstall/lib/libcxcore.so

However if I try to search for cxcore21 or cxcore210 or even
libcxcore.so.2.1.0 it won't return me anything and I'd always see LIBRARY
NOT FOUND being printed.

Could anyone please let me know how to really search for libcxcore.so.2.1.0
file using find_library that is what should I put after NAMES to get the
path of this library. I'm kind of surprised why wouldn't it find even if I
search for libcxcore.so.2.1.0  .Your suggestions will be highly appreciated.

Thanks a lot!
Ankur.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110309/1f265048/attachment-0001.htm>


More information about the CMake mailing list