2011/9/28 Michael Wild <them...@gmail.com>:
> On 09/28/2011 07:47 AM, Clifford Yapp wrote:
>>
>>
>> On Wed, Sep 28, 2011 at 12:13 AM, Michael Wild <them...@gmail.com
>> <mailto:them...@gmail.com>> wrote:
>>
>>     On 09/28/2011 02:44 AM, Clifford Yapp wrote:
>>     > I've run into a situation where find_library is returning a symlink:
>>     >
>>     > /usr/lib/libblah.so -> libblah.so.1
>>     >
>>     >  but libblah.so.1 does not actually exist (e.g. the symlink is bad).
>>     >
>>     > Is there an option I can set to have find_library ensure that a found
>>     > library file is valid and links?
>>     >
>>     > Cheers,
>>     > CY
>>     >
>>
>>     Yes, but you need to do it yourself, e.g. use the CheckFunctionExists
>>     module.
>>
>>     Michael
>>
>>
>> Urm.  That's surprising, and not so hot in that it leads to "false
>> positives" in find_library reports.  Has anyone wrapped find_library
>> with a generic linking test successfully?
>>
>> CY
>
> Only if your installation is broken ;-) If the symlink is broken, I
> consider this to be a user-error. Period. OTOH, CMake /could/ check
> whether the library is a symlink, and if it is, check that it is valid.

I agree that the breakage is on user side and not CMake.
However CMake may just warn that the found symlink is broken,
and nothing more.
At least the user won't be puzzled by a non-working build.


> But how do you test whether a library is "linkable"? Specifically, I'm
> thinking about static libraries. First, only referenced symbols are
> linked, so that's kind of difficult to handle as CMake would need to
> know at least one symbol name to force the library to be linked at all,
> secondly static libraries may have transitive dependencies which CMake
> doesn't know about, so it's not possible to link an executable. On Unix
> you could create a shared library for the link test, but that depends on
> the linker flags being used, and on Windows you can't, since DLL's may
> not contain unresolved symbols.
>
> I don't think that there is any good way to handle this in find_library().

Agreed as well but this is another story.


-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to