[cmake-developers] Making Config.cmake files easier to write

Brad King brad.king at kitware.com
Mon Mar 5 17:12:47 EST 2012


On 3/5/2012 5:04 PM, Alexander Neundorf wrote:
> So instead of:
>
> #   @PACKAGE_HELPER_INIT@
> #   ...
> #   set_and_check(FOO_INCLUDE_DIR "@PACKAGE_HELPER_INCLUDE_INSTALL_DIR@")
> #   set_and_check(FOO_SYSCONFIG_DIR "@PACKAGE_HELPER_SYSCONFIG_INSTALL_DIR@")
>
>
> you prefer the following ?

Yes.

> #   @PACKAGE_INIT@
> #   ...
> #   set_and_check(FOO_INCLUDE_DIR "@PACKAGE_INCLUDE_INSTALL_DIR@")
> #   set_and_check(FOO_SYSCONFIG_DIR "@PACKAGE_SYSCONFIG_INSTALL_DIR@")
>
> I can do that, but I think at least for the variables the "HELPER" makes
> sense.

We've been through this on the thread earlier when it was "CONFIG_HELPER".
The information contained in the variables is about the PACKAGE, not about
the HELPER.  It is PACKAGE_INCLUDE_INSTALL_DIR because the include dir
is for the PACKAGE.  Even the _INIT variable contains code that computes
information about the PACKAGe.  There is precedent for this in the
find_package command's interface for package version files.

-Brad



More information about the cmake-developers mailing list