[Cmake] Issues and new ideas

Ken Martin ken.martin at kitware.com
Thu May 10 14:32:23 EDT 2001


I'm not sure if this extra functionality is required.

> There'll need to be an corresponding extension to the IF command. I
> suggest the third state be called "UNSET" or something like that:
>   IF(HAS_LIB)        - succeeds if HAS_LIB is not "UNSET"
> and is not "NO"
>                        ("NOTFOUND", "FALSE", "0" and other
> negatives)
>   IF(NOT HAS_LIB)    - not( above )
>   IF(SET HAS_LIB)    - succeeds if HAS_LIB is not "UNSET"
>   IF(NOTSET HAS_LIB) - for convenience
>
> Using the variable:
>
> IF(HAS_LIB)
>    do something with it
> ENDIF(HAS_LIB)
>
> In the FindLib module:
>
> IF(NOTSET HAS_LIB)
>   SET( HAS_LIB "NO" CACHE )
>   FIND_LIBRARY(LIB_PATH...)
>   IF(LIB_PATH)
>     SET( HAS_LIB "YES" CACHE )
>   ENDIF(LIB_PATH)
> ENDIF(NOTSET HAS_LIB)
>


With the notion of IGNORE there isn't as much need for a HAS_LIB
value, I thought that was the motivation for adding IGNORE. The above
code would reduce to

FIND_LIBRARY(JPEG_LIBRARY jpeg path path...)

IF (JPEG_LIBRARY)
   do something with it
ENDIF (JPEG_LIBRARY)

IF would only execute if JPEG_LIBRARY was (not (NOTFOUND || IGNORE))
Likewise FIND_LIBRARY would only search for the library when
JPEG_LIBRARY was NOTFOUND (or completely empty)

Ken





More information about the CMake mailing list