[CMake] telling find_package exactly where to find a package

Adolfo Rodríguez dofo79 at gmail.com
Fri Jan 30 05:08:13 EST 2009


Hmmm, nice to know that. I currently do not perform any kind of sanity check
on the include/lib paths, although I print an informative message to the
user. Thanks for the tip!

Adolfo Rodríguez Tsouroukdissian


On Fri, Jan 30, 2009 at 10:49 AM, Philip Lowman <philip at yhbt.com> wrote:

> On Fri, Jan 30, 2009 at 3:44 AM, Adolfo Rodríguez <dofo79 at gmail.com>wrote:
>
>> On Fri, Jan 30, 2009 at 7:11 AM, Philip Lowman <philip at yhbt.com> wrote:
>>
>>> On Fri, Jan 30, 2009 at 12:08 AM, Tyler Roscoe <tyler at cryptio.net>wrote:
>>>
>>>> This seems like a common situation, so surely there's a CMake way to
>>>> handle it? I was hoping the PATHS parameter would do what I want but
>>>> it's for specifying the path to the FindXXX modules.
>>>
>>>
>>> Read the documentation for the find_path() and find_library() commands.
>>> Setting the variable CMAKE_PREFIX_PATH (or environment variable) will likely
>>> be of tremendous help to you.
>>>
>>
>> I have a project with similar requirements as Tyler's, and we effectively
>> use the  CMAKE_PREFIX_PATH variable. The thing is that if you ONLY want the
>> FindXXX.cmake to look in the paths pointed by CMAKE_PREFIX_PATH, and not the
>> standard ones (e.g., /usr, /usr/local, ... on Unix), this might not be
>> enough.
>> FindBoost.cmake has a very convenient variable named Boost_ROOT that
>> specifies where the boost libraries are located. Taking a quick look at the
>> FindQt*.cmake doc, I didn't find a similar functionality, but I still wonder
>> if it can be achieved in a simple way.
>>
>
> Sorry to disappoint, but FindBoost suffers from the same issue in that
> setting Boost_ROOT doesn't guarantee you won't have libraries picked up in
> the system paths.
> http://public.kitware.com/Bug/view.php?id=8412
>
> Worse case, if you absolutely can't stand finding stuff outside of X_ROOT
> perhaps you can obtain the path of X_LIBRARY with GET_FILENAME_COMPONENT()
> and ensure it's within X_ROOT through a regex or something, after you call
> FIND_PACKAGE()? I am considering such an approach with FindBoost to warn
> about detection of a Boost library in a system path when the Boost include
> dir is in Boost_ROOT.
>
> --
> Philip Lowman
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090130/27838172/attachment.htm>


More information about the CMake mailing list