[Cmake] Strange behavior of FIND_PROGRAM

David Svoboda xsvobod2 at informatics.muni.cz
Tue, 2 Mar 2004 11:18:37 +0100


Hello,

I am using CMake version 1.8.2 and have the following problem. I have the
two varibles MY_PROGRAM and USER_DEFINED_PATH (this is a cache variable):

...
# first I do empty the variable:
SET(MY_PROGRAM "NOTFOUND" CACHE FILEPATH "" FORCE)

# then I try to find the program:
FIND_PROGRAM(MY_PROGRAM ${PROGRAM_NAME} ${USER_DEFINED_PATH})
...

In Linux it seems OK.

In Windows: For the first run of CMake I am able to set the
USER_DEFINED_PATH and let the CMake to find the required PROGRAM_NAME. In
case, it does not find anything I can set it manually. Then I can change
the package version and the USER_DEFINED_PATH will store different value
then in the past. If the second run of CMake takes round, the variable
MY_PROGRAM is set to the previous value, in spite of the fact that it was
explicitly set to "NOTFOUND"!!! Why? It seems, that some internal
information is stored in memory - but in this case, it should not have
been! A new program in the new USER_DEFINED_PATH should be found.

This problem does not appear, if the program PROGRAM_NAME is found in
the first CMake run by the CMake. It appears, if it was set by the user
since CMake was able to locate it.

Can anybody advise me, how to fix this problem?


-David