[CMake] FIND_FILE Issue

Surya Kiran Gullapalli suryakiran.gullapalli at gmail.com
Mon Dec 17 04:25:16 EST 2007


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 ?
2. How do i tell CMAKE not to write the variable to Cache ?
3. How do i use FIND_FILE to locate multiple files (like the one I've
explained above)?

Thanks in advance,
Surya


More information about the CMake mailing list