[CMake] pkg-config and cache

Alan W. Irwin irwin at beluga.phys.uvic.ca
Tue Jun 5 19:54:34 EDT 2007


On 2007-06-06 00:16+0200 Andreas Beckermann wrote:

> Hi
> I am using cmake-2.4.5 on Linux along with the FindPkgConfig.cmake file from
> current cmake cvs.
> The pkg_check_modules() macro works mostly fine (thanks a lot, btw, this saved
> me a lot of work), however I have one problem with it: once it checked
> whether the modules are available, it defines a variable
> __pkg_config_checked_<PREFIX> in CMakeCache.txt and won't check for these
> modules again, once that variable is defined.
>
> This means that if a package is not available, the user has to delete
> CMakeCache.txt to make cmake realize that the module has been installed since
> the last run.
>
> I find this behavior very unintuitive - is it intended?
> According to the code there is unfortunately no way around this :-(

I suggest the logic of this module should be changed so it works like the
FIND_FILE et al commands.  For example, if FIND_FILE finds anything, then it
never looks again (until the cache is removed), but if it doesn't find
anything then future searches will be tried again.

I had a look at the __pkg_config_checked_${_prefix} logic, and currently it
does exactly as the name implies and as you stated.  That variable is set to
${PKG_CONFIG_VERSION} (i.e., 1) if that module has been checked regardless
of whether the package was found or not.  I would suggest an internal name
change to __pkg_config_found_${_prefix} (to be consistent with the improved
logic), and only set that variable to ${PKG_CONFIG_VERSION} if the
corresponding package has been found.

We use FindPkgConfig.cmake for both PLplot and libLASi so I would like to
see this improvement in the logic, but I don't have time to do that myself
at the present time.  However, it should be straightforward so I hope somebody
takes this on.

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state implementation
for stellar interiors (freeeos.sf.net); PLplot scientific plotting software
package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of
Linux Links project (loll.sf.net); and the Linux Brochure Project
(lbproject.sf.net).
__________________________

Linux-powered Science
__________________________


More information about the CMake mailing list