[CMake] Find module for the Subversion API

Philip Lowman philip at yhbt.com
Fri Aug 14 03:16:42 EDT 2009


On Thu, Aug 13, 2009 at 4:32 PM, Robert Dailey <rcdailey at gmail.com> wrote:

> In case no one knows this, the Subversion API requires over 10 separate
> dependencies in order to build it into a fully-functional API. In other
> words, there are certain dependencies that are optional, but I'm assuming a
> case where they are all required as far as the Find module is concerned
> (i.e. it can't assume the user won't use certain features and thus is not
> allowed to omit those dependencies from its search). A list of a few that it
> requires:
> apr
> apr-util
> apr-iconv
> neon
> berkeleydb
> openssl
>
> There are many others it depends on. I had considered writing find modules
> for all of these, but there is one major thing stopping me. I do not have
> the knowledge or resources to write find modules for all of these myself. I
> would love more than anything to be able to write find modules for these and
> contribute them to the community. I have no experience with the MAC and no
> development experience with Linux. Only on Windows. Additionally, some of
> these libraries are so tricky to build on Windows that it would be difficult
> to setup a reliable way for the Find module to find these libraries.
>
> What I've been doing is maintaining a fixed list of libraries in my CMake
> scripts and just moving those dependencies in a predictable location so that
> I can "hard-code" the paths to those libraries and includes into my CMake
> projects. What would you guys do in this situation? I obviously could not
> reliably create find modules for these, given the reasons above. But also
> because there is no bold "standard" for find modules. Even when you do know
> what needs to be done to find these libraries, you have to know a standard
> way of setting it up that is acceptable to the CMake project.
>

Nothing is ever easy. :)

Generally what I do is write my find modules to work out of the box on
Linux.  Since nobody wants to find every library/include directory on
Windows manually, generally what we do is to keep dependencies per compiler
in a folder checked into CM.  Then we manipulate CMAKE_PREFIX_PATH to assist
in finding all of the stuff (preserving it's original value so it can still
be used via -D or cache).

Depending on the dependency, we also find some of our Linux dependencies in
the same way.

===
set(DEPS_PATH "" CACHE PATH "Path to the dependencies directory")
set(orig_CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH})

# Wrap calls to each find_package() with the path hint
if(DEPS_PATH AND WIN32)
   list(APPEND CMAKE_PREFIX_PATH ${DEPS_PATH}/foo-1.2.3)
endif()
find_package(Foo)
set(CMAKE_PREFIX_PATH ${orig_CMAKE_PREFIX_PATH})
===


-- 
Philip Lowman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090814/e44747c6/attachment-0001.htm>


More information about the CMake mailing list