On 09/29/2011 01:30 AM, Clifford Yapp wrote:
> On Wed, Sep 28, 2011 at 2:47 AM, Michael Wild <them...@gmail.com> wrote:
> 
>>
>> 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.
>>
> 
> Oh, no question the installation is broken.  I'd just expect find_library to
> do whatever minimal validation it can easily do and not return invalid cases
> it can spot - checking for symlink and whether it's valid would catch one
> general class of error, and perhaps a quick check to see if the file is a
> binary or a text file would be another.   Not perfect, but such tests should
> be relatively simple and would improve the utility of find_library.

What do you do on systems which have no idea of symbolic links, e.g.
previous Windows versions? Adding more platform-specific code to the
sources of the FIND_LIBRARY() function? Furthermore, the kernels of
*nix systems hardly distinguish between binary files and text files;
usually, they know just "files" with the limited exception of being
able to recognize the native executable formats and the #! shebang.
The detection of the diverse file types is typically implemented
in utility programs, notably the file(1) utility.

>> But how do you test whether a library is "linkable"?
>>
> 
> Not sure - autoconf has some sort of test that works in at least some cases
> in their AC_CHECK_LIB macro, but I'm not really clear on what it does.  Even
> if such a test wouldn't catch all cases, mightn't it be useful to fail when
> available tests do detect a problem?

What do you do if the library found by FIND_LIBRARY() has a non-native
binary format, e.g. for cross-compiling purposes? How do you select the
right set of tools to check the library in question without the user's
ado? IMO, FIND_LIBRARY()'s job is to find library files, and a general
check whether these files are valid/usable/linkable and not dangling
symlinks or whatever is beyond the scope of this function; ensuring
that is rather the realm of system administration.

> Cheers,
> CY

Regards,

Michael
--

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