[CMake] Loop expansion in find_library() seems backwards

2010-09-07 Thread Philip Lowman
Let's say I have many different potential names for a library and the
following filesystem

/usr/lib/libnspr4.so
${CMAKE_CURRENT_SOURCE_DIR}/libnspr4a.so

find_library(TEST_LIBRARY
   NAMES nspr4 nspr4a
   HINTS ${CMAKE_CURRENT_SOURCE_DIR}
)

I'm somewhat surprised that the following code finds /usr/lib/libnspr4.so
instead of the alternate name for it (libnspr4a.so).  This tells me that the
loop is backwards.  Shouldn't the find_library() command be iterating the
list of library names across each directory.  For example, the above should
search:

First ${CMAKE_CURRENT_SOURCE_DIR}...
  ${CMAKE_CURRENT_SOURCE_DIR}/libnspr4.so
  ${CMAKE_CURRENT_SOURCE_DIR}/libnspr4a.so
Then the system directories...
  (system paths)/lib/libnspr4.so
  (system paths)/lib/libnspr4a.so
Etc.

The system is actually searching
${CMAKE_CURRENT_SOURCE_DIR}/libnspr4.so
/usr/lib/libnspr4.so
${CMAKE_CURRENT_SOURCE_DIR}/libnspr4a.so
/usr/lib/libnspr4a.so

This is with CMake 2.8.2

-- 
Philip Lowman
___
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

Re: [CMake] Loop expansion in find_library() seems backwards

2010-09-07 Thread Michael Wild

On 8. Sep, 2010, at 8:25 , Philip Lowman wrote:

> Let's say I have many different potential names for a library and the
> following filesystem
> 
> /usr/lib/libnspr4.so
> ${CMAKE_CURRENT_SOURCE_DIR}/libnspr4a.so
> 
> find_library(TEST_LIBRARY
>   NAMES nspr4 nspr4a
>   HINTS ${CMAKE_CURRENT_SOURCE_DIR}
> )
> 
> I'm somewhat surprised that the following code finds /usr/lib/libnspr4.so
> instead of the alternate name for it (libnspr4a.so).  This tells me that the
> loop is backwards.  Shouldn't the find_library() command be iterating the
> list of library names across each directory.  For example, the above should
> search:
> 
> First ${CMAKE_CURRENT_SOURCE_DIR}...
>  ${CMAKE_CURRENT_SOURCE_DIR}/libnspr4.so
>  ${CMAKE_CURRENT_SOURCE_DIR}/libnspr4a.so
> Then the system directories...
>  (system paths)/lib/libnspr4.so
>  (system paths)/lib/libnspr4a.so
> Etc.
> 
> The system is actually searching
> ${CMAKE_CURRENT_SOURCE_DIR}/libnspr4.so
> /usr/lib/libnspr4.so
> ${CMAKE_CURRENT_SOURCE_DIR}/libnspr4a.so
> /usr/lib/libnspr4a.so
> 
> This is with CMake 2.8.2
> 
> -- 
> Philip Lowman

Oh, no! This topic haunts the list ;-) See

http://www.mail-archive.com/cmake@cmake.org/msg30602.html
http://www.mail-archive.com/cmake@cmake.org/msg28946.html
http://www.mail-archive.com/cmake@cmake.org/msg27838.html
http://www.mail-archive.com/cmake@cmake.org/msg24565.html

Michael

--
There is always a well-known solution to every human problem -- neat, 
plausible, and wrong.
H. L. Mencken



PGP.sig
Description: This is a digitally signed message part
___
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

Re: [CMake] Loop expansion in find_library() seems backwards

2010-09-08 Thread Philip Lowman
Wow, that's pretty bad. I even replied to one of those threads. Sorry for
the noise.  The official bug post for this issue is here:
http://public.kitware.com/Bug/view.php?id=10718

I agree with Alan Irwin that it will continue to haunt users well into the
future.

On Wed, Sep 8, 2010 at 2:38 AM, Michael Wild  wrote:

>
> On 8. Sep, 2010, at 8:25 , Philip Lowman wrote:
>
> > Let's say I have many different potential names for a library and the
> > following filesystem
> >
> > /usr/lib/libnspr4.so
> > ${CMAKE_CURRENT_SOURCE_DIR}/libnspr4a.so
> >
> > find_library(TEST_LIBRARY
> >   NAMES nspr4 nspr4a
> >   HINTS ${CMAKE_CURRENT_SOURCE_DIR}
> > )
> >
> > I'm somewhat surprised that the following code finds /usr/lib/libnspr4.so
> > instead of the alternate name for it (libnspr4a.so).  This tells me that
> the
> > loop is backwards.  Shouldn't the find_library() command be iterating the
> > list of library names across each directory.  For example, the above
> should
> > search:
> >
> > First ${CMAKE_CURRENT_SOURCE_DIR}...
> >  ${CMAKE_CURRENT_SOURCE_DIR}/libnspr4.so
> >  ${CMAKE_CURRENT_SOURCE_DIR}/libnspr4a.so
> > Then the system directories...
> >  (system paths)/lib/libnspr4.so
> >  (system paths)/lib/libnspr4a.so
> > Etc.
> >
> > The system is actually searching
> > ${CMAKE_CURRENT_SOURCE_DIR}/libnspr4.so
> > /usr/lib/libnspr4.so
> > ${CMAKE_CURRENT_SOURCE_DIR}/libnspr4a.so
> > /usr/lib/libnspr4a.so
> >
> > This is with CMake 2.8.2
> >
> > --
> > Philip Lowman
>
> Oh, no! This topic haunts the list ;-) See
>
> http://www.mail-archive.com/cmake@cmake.org/msg30602.html
> http://www.mail-archive.com/cmake@cmake.org/msg28946.html
> http://www.mail-archive.com/cmake@cmake.org/msg27838.html
> http://www.mail-archive.com/cmake@cmake.org/msg24565.html
>
> Michael
>
> --
> There is always a well-known solution to every human problem -- neat,
> plausible, and wrong.
> H. L. Mencken
>
>


-- 
Philip Lowman
___
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

Re: [CMake] Loop expansion in find_library() seems backwards

2010-09-08 Thread Michael Hertling
On 09/08/2010 08:38 AM, Michael Wild wrote:
> 
> On 8. Sep, 2010, at 8:25 , Philip Lowman wrote:
> 
>> Let's say I have many different potential names for a library and the
>> following filesystem
>>
>> /usr/lib/libnspr4.so
>> ${CMAKE_CURRENT_SOURCE_DIR}/libnspr4a.so
>>
>> find_library(TEST_LIBRARY
>>   NAMES nspr4 nspr4a
>>   HINTS ${CMAKE_CURRENT_SOURCE_DIR}
>> )
>>
>> I'm somewhat surprised that the following code finds /usr/lib/libnspr4.so
>> instead of the alternate name for it (libnspr4a.so).  This tells me that the
>> loop is backwards.  Shouldn't the find_library() command be iterating the
>> list of library names across each directory.  For example, the above should
>> search:
>>
>> First ${CMAKE_CURRENT_SOURCE_DIR}...
>>  ${CMAKE_CURRENT_SOURCE_DIR}/libnspr4.so
>>  ${CMAKE_CURRENT_SOURCE_DIR}/libnspr4a.so
>> Then the system directories...
>>  (system paths)/lib/libnspr4.so
>>  (system paths)/lib/libnspr4a.so
>> Etc.
>>
>> The system is actually searching
>> ${CMAKE_CURRENT_SOURCE_DIR}/libnspr4.so
>> /usr/lib/libnspr4.so
>> ${CMAKE_CURRENT_SOURCE_DIR}/libnspr4a.so
>> /usr/lib/libnspr4a.so
>>
>> This is with CMake 2.8.2
>>
>> -- 
>> Philip Lowman
> 
> Oh, no! This topic haunts the list [...]

...which shows that 10718 is still alive. ;-)

Hi Philip,

what's your opinion on this topic, in particular

- swapping loops and the required effort, the related risks
  and the expected results,
- find modules with hardcoded magic numbers and the continuous
  need for maintenance,
- globbing or regex support for FIND_{PROGRAM,LIBRARY,PATH,FILE}?

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


Re: [CMake] Loop expansion in find_library() seems backwards

2010-09-08 Thread Philip Lowman
On Wed, Sep 8, 2010 at 8:56 AM, Michael Hertling wrote:

> ...which shows that 10718 is still alive. ;-)
>
> Hi Philip,
>
> what's your opinion on this topic, in particular
>
> - swapping loops and the required effort, the related risks
>  and the expected results,
>

I'd like to know if there is a use case for the existing behavior.  I don't
really have an opinion if this should be enabled optionally or by default
(or via policy) yet.


> - find modules with hardcoded magic numbers and the continuous
>  need for maintenance,
> - globbing or regex support for FIND_{PROGRAM,LIBRARY,PATH,FILE}?
>
>
I've griped about this for a while.  So much that I even started working on
a patch for the issue back when I had some free time last year (but never
finished).  What little time I have these days to spend on CMake I choose to
spend on supporting find modules, so if anyone wants to take this over... It
was one approach for how to solve the version number problem...

http://www.cmake.org/Bug/view.php?id=8396

-- 
Philip Lowman
___
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