[CMake] Add search paths for FIND_PACKAGE ?

Mike Jackson imikejackson at gmail.com
Mon Nov 19 09:00:17 EST 2007


Actually I run into this ALL the time (tiff, expat, hdf5) and I have  
most of mine stored in "non-Standard" locations. I end up copying the  
the FindXXX.cmake into my local project directory and then adding  
some code like the following:

SET(EXPAT_INCLUDE_SEARCH_DIRS
   $ENV{EXPAT_INSTALL}/include/expat
)

SET (EXPAT_LIB_SEARCH_DIRS
   $ENV{EXPAT_INSTALL}/lib
   )

FIND_PATH(EXPAT_INCLUDE_DIR
   NAMES expat.h
   PATHS ${EXPAT_INCLUDE_SEARCH_DIRS}
   NO_DEFAULT_PATH
   )

The important part is that I am looking for an environment variable  
to help find the paths/libraries. This type of thing could be added  
the the FindXXX.cmake files so if someone has their libs installed in  
non-standard locations they can set an env variable and let cmake  
find the package that way.


Also.. Why would I "hard-code" paths into a "cross-platform" build  
system.. that is just asking for trouble. If Stephen has one of his  
associates build his source for him then that associates computer  
must be laid out the EXACT same way which is not going to happed.

-- 
Mike Jackson   Senior Research Engineer
Innovative Management & Technology Services


On Nov 19, 2007, at 1:34 PM, David Cole wrote:

> What is wrong with explicitly specifying the non-standard locations  
> up front so that FIND_PACKAGE has nothing to do?
>
> In other words, prime all the relevant cache variables with the non- 
> standard locations.
>
> There are many Find* scripts in the CMake Modules directory. I  
> think it would be difficult to make a blanket recommendation  
> concerning all of them that would be true 100% of the time with  
> FIND_PACKAGE.
>
>
> Are there specific packages you are having difficulty with?
>
>
> On 11/19/07, Stephen Collyer <scollyer at netspinner.co.uk> wrote:
> This would seem to be a very frequently asked question
> but I can't find it anywhere in the wiki or FAQ:
> how do I tell FIND_PACKAGE to search on additional paths
> to the default set, so I can work with packages installed
> in non-standard locations ?
>
> --
> Regards
>
> Steve Collyer
> Netspinner Ltd
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake
>
>
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/cmake/attachments/20071119/319fe734/attachment-0001.html


More information about the CMake mailing list