[CMake] recommended way to disable a package ?

Filipe Sousa filipe at ipb.pt
Sun Jan 29 20:13:01 EST 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Alexander Neundorf wrote:
> Hi, 
>  
> let's say I have a FindAGG.cmake, and it finds everything it requires. It 
> is used with FIND_PACKAGE(AGG). 
> But let's say the user doesn't want libagg support althoug it is 
> installed. 
> cmake . -DAGG_FOUND:BOOL=FALSE 
> doesn't seem to work, since AGG_FOUND is no cache variable. Can it be 
> turned into a cache variable ? 
> If not, currently the user could start ccmake and set AGG_INCLUDE_DIR 
> empty, this would make AGG_FOUND false during cmake time. But the usual 
> user won't know that setting AGG_INCLUDE_DIR will make AGG_FOUND false. 
>  
> So, should this be wrapped into an OPTION() or is there another way ? 
>  
> Bye 
> Alex 

If the user don't want AGG feature in his project then I think the
OPTION is the write way

FIND_PACKAGE(AGG)
IF(AGG_FOUND)
  OPTION(USE_AGG "AGG Support" ON)
  IF(USE_AGG)
    ADD_DEFINITIONS(-DUSE_AGG)
  ENDIF(USE_AGG)
ENDIF(AGG_FOUND)

- --
Filipe Sousa
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)

iD8DBQFD3WgdbQdNYqwwwCwRAtSqAJ4to5KNozP3PQ5MJAy6umKiHMQSeACgkDi3
DfN9YLKbi6XZ8kaMjY24zp0=
=rNsy
-----END PGP SIGNATURE-----


More information about the CMake mailing list