[CMake] Add search paths for FIND_PACKAGE ?

Christian Ehrlicher Ch.Ehrlicher at gmx.de
Mon Nov 19 14:14:00 EST 2007


Mike Jackson schrieb:
> 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.
> 
Search for CMAKE_INCLUDE_PATH and CMAKE_LIBRARY_PATH


Christian


More information about the CMake mailing list