[CMake] Does find_library check that a found library does in fact link?

Rolf Eike Beer eike at sf-mail.de
Thu Sep 29 03:41:02 EDT 2011


> On 09/29/2011 07:15 AM, Clifford Yapp wrote:
>> On Wed, Sep 28, 2011 at 8:52 PM, Michael Hertling
>> <mhertling at online.de <mailto:mhertling at online.de>> wrote:

>> I guess the question revolves around the expectation of find_library
>> being different from find_file - as a user, my expectation would be
>> that find_library is doing something to distinguish libraries from
>> files (when that's technically workable, of course - clearly solving
>>  that problem in general is hard.)  If something tricky like
>> cross-compiling is going on then the simpler testing behavior is in
>> order, but couldn't CMake scrub the results looking for library
>> validity as much as possible?
>>
>> Cheers, CY
>
> Just a few of my thoughts on this:
>
> - There are several ways to handle dead symlinks:
>   1. Don't check, let the linker complain (status quo)
>   2. Check whether the found library is a symlink, and if not valid,
>      remove it silently from the list of candidates. Can be very
>      surprising and will likely result in quite a few bug reports
>      about CMake not finding a certain library that is "clearly" there.
>   3. Like 2, but warn about the issue. Possibly very annoying.

3a) Warn about skipped links if no library is found at the end (e.g.
"foolib not found, dead symlinks ignored during search") or when called
with some debug flag.

Eike


More information about the CMake mailing list