[CMake] Specifying search path for FIND_PACKAGE

Amit Ramesh amit.ramesh at cshs.org
Fri Nov 11 19:50:08 EST 2005


On Nov 11, 2005, at 4:02 PM, Brad King wrote:

> For packages that have CMake Find modules then FIND_PACKAGE will  
> always use the first Find module it encounters for a package.  What  
> you probably want is for the Find module itself to look for its  
> package in /sw.  One thing you can do is create a directory with  
> copies of the CMake Find modules that you have modified to include / 
> sw in the search path.  Then specify this directory in  
> CMAKE_MODULE_PATH and FIND_PACKAGE will favor the new version.

     Well I am really looking for a clean solution rather than a  
hack, something that would work on machines with a standard CMake  
installation. Looks like there might be such a solution at this point.


> If it is safe to use /sw packages for Darwin builds (instead of  
> frameworks?) then you could contribute the fixes back to CMake and  
> we will include the /sw search paths in the next release.

     Fink installations are specifically OS X ports, so I guess they  
should be okay for builds. I am not knowledgeable enough to answer  
that conceptually because I come from the Linux world. But in  
practice I do that all the time. In fact our current build uses DCMTK  
libraries from the Fink installation, and that is what I would like  
to have CMake automatically pick up.

     IMHO it would be nicer to have a CMake variable that contains  
the paths to search for packages, rather than specifically include / 
sw for Macs. It is always possible that different people might use  
different conventions as to where they would like to install  
packages. For example, on unix systems apart from  /usr  and /usr/ 
local, sometimes /opt is used for some utilities. Similarly on the  
Mac /opt is where Darwin ports are installed while /sw is used by Fink.

- Amit



More information about the CMake mailing list