[Cmake] FIND_PACKAGE?
Brad King
brad.king at kitware.com
Wed Mar 5 14:57:50 EST 2003
> What does FIND_PACKAGE do? It doesn't seem to be in the manual.
This command was added just before the 1.6 release. It is intended to
make it easier to transition other projects into CMake-built projects.
It works as follows:
FIND_PACKAGE(FOO)
1.) Search ${CMAKE_MODULE_PATH} for a file called FindFOO.cmake,
followed by ${CMAKE_ROOT}/Modules. If found, include it and stop.
2.) Create a FOO_DIR cache entry that should be set by the user to a
directory containing a file called FOOConfig.cmake. If set, and
the file exists, it is included.
In case (1), the user usually has to set a bunch of FOO_INCLUDE_DIR,
FOO_LIBRARY, ... variables that are requested by the "find" module. In
case (2), the project knows about CMake and has created a FOOConfig.cmake
containing all the proper settings (VTK and ITK do this). Then the user
need only set FOO_DIR to the location of FOOConfig.cmake, and all the rest
of the settings are loaded automatically.
The idea is that CMake cannot provide a FindFOO.cmake module for every
project FOO. FIND_PACKAGE is a way of generalizing the find mechanism so
projects don't have to use ${CMAKE_ROOT}/Modules for everything.
Eventually some kind of version support may be added too.
-Brad
More information about the CMake
mailing list