[CMake] Confusion regarding usage of find_package and PATHS or HINTS

Nils Gladitz nilsgladitz at gmail.com
Tue Jun 10 13:21:58 EDT 2014


On 10.06.2014 19:09, jmerkow wrote:
> Is there a generally accepted method to pass extra paths to find_package in
> module mode? To get around this,  I have been doing something like this:
>
> set(FOO_EXTRA_PATHS path1 path2)
> Find_package(FOO)
>
>
> In FindFOO.cmake:
> ...
> set(FOO_LIB_POSSIBLE_PATHS ${FOO_EXTRA_PATHS} /path3/)
> ...
> (Use the possible paths in find_library/find_file/etc)
>
>
> Jameson
>

For additional search paths in which to find modules themselves there is 
CMAKE_MODULE_PATH but given your example that is I assume not what you 
are looking for.

There is CMAKE_PREFIX_PATH (environment or cmake cache variable) which 
is however intended to be used by users of a project so they can tell 
cmake about their local non standard prefixes rather than by project 
authors.

Would that fit your use case?

Nils


More information about the CMake mailing list