[CMake] [ANN] New PkgConfig module

Maik Beckmann maikbeckmann at gmx.de
Wed Nov 1 09:41:31 EST 2006


> Maik Beckmann wrote:
> > Hello 
> > 
> > I would like to discuss three points
> > 
> > 1. naming conventions
> > 2. what if pkg-config sends an error
> > 3. protect already defined variables
> 
> Another approach to this problem is to setup the pkgconfig macros so
> they can be used by Find*.cmake modules.  When a user wants to find
> package Foo it should not matter how it is found.  The user should be
> able to write
> 
> FIND_PACKAGE(FOO)
> 
> and get FOO_FOUND, FOO_INCLUDE_DIRS, etc. without knowing that it was
> found via pkgconfig.  I'm not asking you to rewrite all our find modules
> with your macros, but just to think about how the macros might be used
> in the modules in the future.
> 
> > ------------------------------------
> > 
> > 1. naming conventions:
> > ...
> The conventions used by other Find* modules are documented in the source
> tree under CMake/Modules/readme.txt.

Thanks, I didn't know.

> > ----------------------------------
> > 2. what if the lib isn't found
> > 
> > This regards the pkg_check_modules interface. If the lib(s)
> > wasn't/weren't found or version(s) to low the developer should be able
> > to react.
> > 
> > IMHO there are two possible solution
> > 
> > first:
> > pkg_config(MYPREFIX found "lib1 >= ??? lib2 >= ??? ...")
> > if(NOT found)
> > 	# FATAL_ERROR of looking for alternatives ...
> > endif(NOT found)
> > 
> > second:
> > pkg_config(MYPREFIX "lib1 >= ??? lib2 >= ??? ...")
> > if(NOT MYPREFIX_FOUND)
> > 	# FATAL_ERROR of looking for alternatives ...
> > endif(NOT MYPREFIX_FOUND)
> > 
> > What do you're like more?
> 
> MYPREFIX_FOUND would be consistent with all the other Find* modules.

Okay, so we should stick with this.

> > ----------------------------------
> > 3. protect already defined variables
> > How can we ensure that variables of the module-user won't be overwritten
> >  ...
> This is not necessary.  Just using the private prefix is good enough.
> If PKGCONFIG_PRIVATE is too verbose just use "_" as a prefix.  This
> convention has been followed by some other macro authors.


What about module authors who uses other modules? The modules may
"_"-prefix the same variable name, i.e. "_to".

> -Brad

Thanks for this wonderful tool!

Maik



More information about the CMake mailing list