[CMake] find_package is fantastic

Mathieu Malaterre mathieu.malaterre at gmail.com
Wed Nov 4 13:47:23 EST 2009


On Wed, Nov 4, 2009 at 7:30 PM, Brad King <brad.king at kitware.com> wrote:
> FYI, you don't actually need the HINTS option either.
> Just set CMAKE_PREFIX_PATH in your environment to point
> at the installation prefix (or even the build tree).
>
> You can also set the env var MyPacakage_DIR and it will be used
> automatically.  I've just committed documentation and testing
> for this old but previously un-advertised feature.

This is even simplier !

Speaking of missing documentation, there may be a general confusion
due to some case-insensive cmake module. When one look at
FindLibXml2.cmake, which sets LIBXML2_LIBRARIES / LIBXML2_INCLUDE_DIR,
people may think that
setting MyPackage_DIR is equivalent to setting MYPACKAGE_DIR. This is
not the case and for example:

  find_package(CaSeSeNsItiVe)

will actually look for CaSeSeNsItiVeConfig.cmake and one has to set
CaSeSeNsItiVe_DIR.

2cts
-- 
Mathieu


More information about the CMake mailing list