[CMake] on find_package and building dependencies

Eric Noulard eric.noulard at gmail.com
Tue Jan 3 13:29:17 EST 2012


2012/1/3 Alexander Neundorf <a.neundorf-work at gmx.net>:
>> you basically want:
>> set(CMAKE_FIND_ROOT_PATH "/you/local/install/dir")
>> before calling find_package(...)
>
> No, please don't.
> CMAKE_FIND_ROOT_PATH is intended for cross-compiling, to tell cmake where the
> root of the target file system is located.

Ok my bad.

Sorry Alex (twice in fact) for giving wrong advice concerning this.

I wasn't aware of the fact that CMAKE_FIND_ROOT_PATH was **reserved**
for cross-compiling.

> Use CMAKE_PREFIX_PATH instead. It can contain a list of directories, and
> find_program(), find_file(), find_path(), find_package() and find_library()
> append bin/, include/ and lib/ respectively to each of the directories listed
> there.
> The directories resulting from CMAKE_PREFIX_PATH are checked before all PATHS
> and HINTS directories.
>
> E.g. if you have stuff inside /your/local/install/dir and /some/other/dir, do
> $ export CMAKE_PREFIX_PATH=/your/local/install/dir:/some/other/dir
> $ cmake ...args
>
> or set it directly as a cmake variable within your CMakeLists.txt.
>
> Alex



-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org


More information about the CMake mailing list