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

Pablo Yanez Trujillo shaoran at sakuranohana.org
Mon Nov 24 11:00:43 EST 2008


-----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-----


More information about the CMake mailing list