[CMake] CMAKE_LIBRARY_PATH appears not to work properly for finding libtcl

Bill Hoffman bill.hoffman at kitware.com
Fri May 14 15:59:21 EDT 2010


On 5/13/2010 2:48 PM, Alan W. Irwin wrote:

>>
>> This was by design. The idea was that you find the first copy of
>> something that is in the PATH. The names were not expected to be in
>> any particular order. They were supposed to be equivalent. If it found
>> one good. And, just like PATH it should find the first one that it finds.
>
> I think you have just described the behaviour that I want and which I
> believe most people expect. Search for all names in the first alternate
> location, then in the second, etc., until you get a hit. But as my simple
> example demonstrates that is not what has been implemented (at least for
> FIND_LIBRARY) which is search for the first name in all locations in turn,
> then continue for the second name, etc., until you get a hit.
>
Then, I described it poorly.  :)

It will find the first of any of the named things in the PATH.  This 
assumes all names are equally desirable, and if what ever the first one 
found is good enough.

find_program(foo NAMES fooalias1 fooalias2 fooaliase3)

This will find the first fooalias in the PATH.

What you want is for it to find fooalias1 even if there is a fooalias3 
higher in the PATH.  That is not what it does... :)


-Bill


More information about the CMake mailing list