[CMake] telling find_package exactly where to find a package

Adolfo Rodríguez dofo79 at gmail.com
Fri Jan 30 03:44:04 EST 2009


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:
>
>> I'll spend some more time reading FindQt4.cmake at work tomorrow, but I
>> wanted to post this while I'm thinking about it.
>>
>> I would like to tell find_package where my third-party libraries are (Qt
>> specifically). Since I know where the libraries are, I could manually
>> add paths to INCLUDE_DIRS and LINK_LIBRARIES, but FindQt4 already knows
>> how to do all of that so why duplicate the effort?
>>
>> This is for an internal build system, so I want to use a specific
>> version of Qt installed on a networked filesystem to prevent any
>> weirdness caused by a developer compiling against some random Qt that
>> she might have on her dev machine.
>>
>> 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.


A side-comment that is tangentially related to the subject: all of our
custom-made FindXXX.cmake files use the HINTS property of find_path(...) and
find_library(...) (CMake >= 2.6).

HTH,

Adolfo Rodríguez Tsouroukdissian


> --
> Philip Lowman
>
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090130/0b44780f/attachment.htm>


More information about the CMake mailing list