[CMake] cmake 2.4.1 FIND_PATH

William A. Hoffman billlist at nycap.rr.com
Wed Jun 7 12:30:54 EDT 2006


At 12:03 PM 6/7/2006, frederic heem wrote:

>I disagree on this point, if the user sets paths in FIND_, he expects that 
>cmakes searches these path, only if it fails, cmake can look for default 
>ones, but only if it cannot be found in the path specified by the user.
>Suppose that pwlib that comes with the distribution is installed  
>in /usr/local, and one wants to dowload the new version in $ENV{PWLIBDIR}, 
>FIND_* shall look first in  $ENV{PWLIBDIR}, then in /usr/local/
>The workaround is to set NO_DEFAULT_PATH, but it no longer looks for default 
>if pwlib is not found in $ENV{PWLIBDIR} or in a path specified in FIND_*
>
>> -Bill


You can do this:

# first try env variable
FIND_PATH(PWLIB_INCLUDE_DIR ptlib.h
  $ENV{PWLIBDIR}/include
   NO_DEFAULT_PATH
)
# if it is not found then look for it in the standard places
FIND_PATH(PWLIB_INCLUDE_DIR ptlib.h)

-Bill




More information about the CMake mailing list