[CMake] find_library(): prioritize custom search path

Nagger nagger at gmx.de
Mon Dec 16 09:47:02 EST 2013


Am 16.12.2013 14:57, schrieb Nico Schlömer:
> Hi all,
>
> when using find_library(...), and two versions of libX are installed,
> I would like to prioritize the one found it /my/custom/path/ over the
> one in /usr/lib/. As explained in the find_library()'s help
> <http://www.cmake.org/cmake/help/v2.8.12/cmake.html#command:find_library>,
> putting that path in the HINTS field will still have CMake pick
> /usr/lib/libX.{so,a}.
> What's would be the correct way of prioritizing a provided path over
> CMake's search defaults?
>
> Cheers,
> Nico
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>

Call find_library() twice for the same variable.
First with your priority HINT and NO_DEFAULT_PATH flag (or a combination 
of the other NO_CMAKE_* flags) and a second time for default settings.
The second search will be skipped automatically, if the former succeeds.




More information about the CMake mailing list