[CMake] cmake 2.4.1 FIND_PATH

William A. Hoffman billlist at nycap.rr.com
Wed Jun 7 11:47:43 EDT 2006


At 11:33 AM 6/7/2006, frederic heem wrote:
>Hi,
>After switching from 2.2 to 2.4, my application didn't behave correctly, the 
>root of the problem is a change in FIND_PATH work. Here one of this:
>FIND_PATH(PWLIB_INCLUDE_DIR ptlib.h
>  $ENV{PWLIBDIR}/include
>  /usr/include
>)
>
>cmake always takes /usr/local/include/ptlib.h, which is not the one desired, 
>it shall take $ENV{PWLIBDIR}/include/ptlib.h if any
>A workaround is to set to have add NO_DEFAULT_PATH like this 
>
>FIND_PATH(PWLIB_INCLUDE_DIR ptlib.h
>  $ENV{PWLIBDIR}/include
>  /usr/include
>  NO_DEFAULT_PATH 
>)
>
>Is there any reason why cmake searches first default directory and then user 
>defined ones ? It is more logical to have this opposite and it also preserves 
>backward compatibility.
>Regards.


CMake always searched the paths listed in the arguments to FIND_* last.
It is just better at searching now.  The idea behind searching the
user specified stuff is best explained with FIND_PROGRAM.
If a user has foo in the PATH and you do a FIND_PROGRAM(FOO_BAR foo /some/other/stuff),
the user would expect that cmake would find the same foo that was in
the PATH, just like a shell would.   I don't think they would want to find
/some/other/stuff/foo if unless they put foo in the PATH.   

-Bill



More information about the CMake mailing list