[CMake] script to generate FindFoo.cmake files

Filipe Sousa filipe at ipb.pt
Mon Jan 23 16:54:54 EST 2006


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

Alexander Neundorf wrote:
> Hi, 
>  
> attached you can find a ruby script which helps with creating simple 
> standard FindFoo.cmake files, a sample generated file is also attached. 
>  
> Both these files are in KDE svn 
> (http://websvn.kde.org/trunk/KDE/kdesdk/cmake/modules/). 
>  
> Can you please check that the attached FindLibXml2.cmake follows all your 
> rules for cmake modules, so that nothing would have to be changed to have 
> it included in cmake cvs ? 
>  
> The reason I ask is because this file was generated using the attached 
> script. In the case that KDE decides to use cmake as official 
> buildsystem, there will probably a lot of FindFoo.cmake files be 
> generated using this script. 

It looks good to me

> So I'd like to get some input whether the generated file is ok as it is 
> now or whether there are some things wrong. 
> Especially please have a look at how _FIND_REQUIRED and _FIND_QUIETLY are 
> handled. 

If you do FIND_PACKAGE(LibXml2) and the package is not found in the
system no message is displayed to the user.

I made this change, what do you think?

IF(LIBXML2_FOUND)
  IF(NOT LibXml2_FIND_QUIETLY)
    MESSAGE(STATUS "Found LibXml2: ${LIBXML2_LIBRARY}")
  ENDIF(NOT LibXml2_FIND_QUIETLY)
ELSE(LIBXML2_FOUND)
  IF(LibXml2_FIND_REQUIRED)
    MESSAGE(SEND_ERROR "Could not find LibXml2")
  ELSE(LibXml2_FIND_REQUIRED)
    IF(NOT LibXml2_FIND_QUIETLY)
      MESSAGE(STATUS "Could not find LibXml2")
    ENDIF(NOT LibXml2_FIND_QUIETLY)
  ENDIF(LibXml2_FIND_REQUIRED)
ENDIF(LIBXML2_FOUND)


> Also attached you can find a cmake module for using information from 
> pkgconfig. 

It's annoying to see
running /usr/bin/pkg-config libxml-2.0 --exists  2>&1
Add a dummy var to EXEC_PROGRAM
EXEC_PROGRAM(${PKGCONFIG_EXECUTABLE} ARGS ${_package} --exists
RETURN_VALUE _return_VALUE OUTPUT_VARIABLE dummy)

> Do you think it could be improved by putting some variables in the 
> cache ? If so, how ? 

I'm against cache variables

> Thanks 
> Alex 

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

iD8DBQFD1VCubQdNYqwwwCwRAppHAJ956M+5dkx+GKuXv6qrtG+3AYQ/2QCfSi0R
LYVn/BphPJN9qaYU6TruRVk=
=BkdQ
-----END PGP SIGNATURE-----


More information about the CMake mailing list