[CMake] running FIND_PROGRAM twice
Brandon Van Every
bvanevery at gmail.com
Mon Jan 14 20:20:14 EST 2008
On Jan 14, 2008 6:55 PM, Miguel A. Figueroa-Villanueva <miguelf at ieee.org> wrote:
>
> On Jan 14, 2008 7:18 PM, Brandon Van Every wrote:
> > I just filed bug http://cmake.org/Bug/view.php?id=6241 , "FindPerlLibs
> > should use FindPerl". My assumption is that if FIND_PROGRAM is run
> > twice with the same output variable (in this case PERL_EXECUTABLE),
> > the 2nd invocation will wipe out the value from the 1st invocation.
> > Is that a correct assumption?
>
> As I understand it, the second time will only execute if the first
> attempt is failed. That is, FIND_PROGRAM(output_var ...) sets
> output_var as a cache variable. If it is set to a XXX-NOTFOUND value
> then the second time it is invoked it will search again. If it is
> found the first time, then the second time it won't search for it
> (since it is found).
>
> This limitation has to do with not overiding values that the user sets
> in the GUI.
I should clarify. I mean FIND_PROGRAM is run twice in the same
invocation of CMakeLists.txt, with different parameters. Example:
FIND_PROGRAM(PERL_EXECUTABLE
perl
"C:/Perl/bin"
[HKEY_LOCAL_MACHINE\\SOFTWARE\\ActiveState\\ActivePerl\\804]/bin
[HKEY_LOCAL_MACHINE\\SOFTWARE\\ActiveState\\ActivePerl\\628]/bin
${CYGWIN_INSTALL_PATH}/bin
)
FIND_PROGRAM(PERL_EXECUTABLE perl )
Let's say the 1st FIND_PROGRAM finds a perl using HKEY. Will the 2nd
FIND_PROGRAM come up with NOTFOUND?
Cheers,
Brandon Van Every
More information about the CMake
mailing list