[CMake] find_program search order

Andreas Beckermann b_mann at gmx.de
Fri Jul 28 10:21:17 EDT 2006


On Friday 28 July 2006 15:49, William A. Hoffman wrote:
> At 07:20 PM 7/27/2006, Andreas Beckermann wrote:
> >Hi
> >I have a problem with the search order of FIND_PROGRAM in cmake 2.4.2. The
> >docs say:
> >
[...]
> >SET(KDE3_DCOPIDL_EXECUTABLE "")
> >FIND_PROGRAM(KDE3_DCOPIDL_EXECUTABLE NAME dcopidl)
> >
> >This code won't find dcopidl. If I remove the SET() line however, dcopidl
> > _is_ found.
> >
> >So to me this looks like a cmake bug. Any idea how to work around this?
>
> The key word is NAMES and not name, that is the problem.  It should be :
[...]

Interesting - this indeed fixes the problem, thanks a lot. Attached is a patch 
that fixes cmake's official FindKDE3.cmake from cvs accordingly.
The other issues mentioned at
  http://www.cmake.org/Bug/bug.php?op=show&bugid=3325&pos=1
are not addressed by this patch. See that bug report for fixes for them.


Anyway I'd like to know why 
  FIND_PROGRAM(KDE3_DCOPIDL_EXECUTABLE NAME dcopidl)
works at all then. From the docs I'd say find_program should search for a 
program named "NAME" now, which of course does not exist.
However if KDE3_DCOPIDL_EXECUTABLE is not set, this call _does_ 
find /usr/bin/dcopidl, although the "dcopidl" is at a meaningless (according 
to the docs) position.

Why is that so?
And why does it behave differently when KDE3_DCOPIDL_EXECUTABLE has been set 
to something before?
I'd really like to understand that.

CU
Andi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: FindKDE3.cmake.diff
Type: text/x-diff
Size: 951 bytes
Desc: not available
Url : http://public.kitware.com/pipermail/cmake/attachments/20060728/c8269321/FindKDE3.cmake.bin


More information about the CMake mailing list