[CMake] How to properly write a Module/<Package>Config.cmake file

Ioan Calin Borcoman iborco at gmail.com
Mon Nov 24 11:23:09 EST 2008


Why not provide a pkg-config .pc file that can be used by your users?

The syntax of .pc files is quite simple and your user can use
pkg_check_module once the .pc is installed (or even use some some
other build system that knows how to handle pkg-config, like
autotools).

Cheers,

Ionutz

On Mon, Nov 24, 2008 at 6:00 PM, Pablo Yanez Trujillo
<shaoran at sakuranohana.org> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi
>
> I'm reading http://www.cmake.org/cmake/help/cmake2.6docs.html#command:find_package for the usage of FIND_PACKAGE, but
> I'm not interested in using the FIND_PACKAGE command but to write a Module so that anybody is able to use
> FIND_PACKAGE(myLib ...).
>
> I don't really unterstand what exactly is done by FIND_PACKAGE. The docu states that FIND_PACKAGES searches for
> FindmyLib.cmake and executes it. If the package is found then the variables myLib_FOUND is set. But who sets this
> variable? FIND_PACKAGE or FindmyLib.cmake? And how does FIND_PACKAGE know that a package was not found?
>
> My second question is:
> the simple signature is of FIND_PACKAGE is
> find_package(<package> [version] [EXACT] [QUIET]
>               [[REQUIRED|COMPONENTS] [components...]])
>
> How does FindmyLib.cmake get the version argument of the FIND_PACKAGE call?
>
> What is really the difference between FindmyLib.cmake and myLibConfig.cmake? When should I write the first one and when
> the second one? Or should I always write both?
>
> Thanks
>
> Pablo
>
> - --
> Pablo Yanez Trujillo
> http://klingsor.informatik.uni-freiburg.de
> My public key: http://klingsor.informatik.uni-freiburg.de/gpg/supertux.asc
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v2.0.9 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iEYEARECAAYFAkkqz6oACgkQDzf8xo+0xRVq0gCgptCb+qTUa7/4tgk60Iy1jfEc
> pNMAoIx3S4WF3B1UPBmjnlyx1JgzcEeH
> =8UHN
> -----END PGP SIGNATURE-----
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake
>


More information about the CMake mailing list