[CMake] FIND_FILE Issue

Alexander Neundorf a.neundorf-work at gmx.net
Mon Dec 17 12:59:30 EST 2007


On Monday 17 December 2007, Surya Kiran Gullapalli wrote:
> Hello all,
> I'm a newbie to Cmake and I'm having trouble in FIND_FILE.
>
> I'm using FIND_FILE in a loop like this.
>
> SET (${THIS_FILE} INTERNAL "Temporary Variable" FORCE)
> # I Tried this one also
> # SET (THIS_FILE INTERNAL "Temporary variable" FORCE). But this one
> threw errors.
> FOREACH (ofile ${FILES})
> FIND_FILE (THIS_FILE ${ofile} PATHS ${path1} ${path2} ${path3})
> MESSAGE (${THIS_FILE})
> # I've used MARK_AS_ADVANCED (CLEAR THIS_FILE), but the result was the
> same. ENDFOREACH (ofile)
>
> FInd_file runs for the first time and if the file is found it sets the
> variable THIS_FILE and it is cached. For the second time, FIND_FILE
> does not gets executed due to the presence of cached variable
> THIS_FILE. So in the end I end up with only one file.
>
> Questions.
>
> 1. How do i clear a cached variable ?

You can set the variable to "NOTFOUND" (and FORCE it in the cache) to make 
FIND_XXX() run again.
But I think you shouldn't do this, it's a feature.
Why do you use FIND_XXX() multiple times with the same variable ?

Alex


More information about the CMake mailing list