[CMake] return value of find_library

Michael Hertling mhertling at online.de
Mon Sep 26 19:15:01 EDT 2011


On 09/23/2011 09:20 PM, Yifei Li wrote:
> On Sep 22, 2011, at 2:39 PM, David Cole wrote:
> 
>> It should always be a full path for a valid found library. Under what
>> circumstances are you getting exactly "mylib" ? ?
> Here is a real example:
> 
> find_package(OpenMesh)
> message("${OPENMESH_LIBRARY}")
> 
> find_package(ARPACK)
> message("${ARPACK_LIBRARY}")
> 
> find_package(SUPERLU)
> message("${SUPERLU_LIBRARY}")
> 
> 
> only the last one, ${SUPERLU_LIBRARY}, is the full path.
> 
> P.S.,  I have cmak 2.8-5 installed on my Macbook Pro running Lion

These are FIND_PACKAGE() calls, but in your initial posting, you
talked about FIND_LIBRARY(). Could you please provide a minimal
and self-contained example that shows up your issue concerning
FIND_LIBRARY() for further investigation?

BTW, the OpenMesh and ARPACK find modules or configuration files - I
haven't inspected them yet - might use imported targets to make their
libraries known to other packages, i.e. the *_LIBRARY variables contain
the imported targets' names, whereas their full paths are stored in the
associated IMPORTED_LOCATION[_<CONFIG>] target properties. In this way,
it's quite possible that the *_LIBRARY variables do not contain full
paths. Do your OpenMesh and ARPACK find modules / config files use
imported targets, or do they use full paths immediately?

Regards,

Michael

>> On Thu, Sep 22, 2011 at 11:26 AM, Yifei Li <yifli at mtu.edu> wrote:
>>> Hi all,
>>>
>>> Say I have find_library(MYLIB mylib  PATHS ?) ,   I don't understand why MYLIB sometimes is a full path to mylib and sometimes only contains 'mylib'.
>>>
>>> Thanks
>>>
>>> Yifei


More information about the CMake mailing list