[CMake] installing a module

David Ojeda david.ojeda at gmail.com
Tue Aug 25 09:23:55 EDT 2009


On Tue, Aug 25, 2009 at 12:47 PM, Andreas Pakulat <apaku at gmx.de> wrote:

> On 25.08.09 12:37:46, David Ojeda wrote:
> > I have a shared library that I managed to compile and install using
> cmake.
> > This is working great but now I want to use this library in another
> > cmake-based development. Normally, as with any other shared library, I
> use a
> > FindPackage to get the include and linker flags. However, since I am
> using
> > my shared library, I wrote a cmake module. Once again this is working ok
> and
> > I would like to include this module as a part of the files installed by
> the
> > library.
>
> So you don't want that, you want it to be either part of cmake or part of
> all projects using that library. The reason is simple, if the library is
> not installed, its find-module won't be installed. Hence upon the cmake-run
> in the project using the lib you'll get a cryptic error message that
> library_DIR is not set properly.
>

Thank you for your response Andreas,

Actually I get a not so cryptic error, which says that it does not find the
module:

 CMake Warning at CMakeLists.txt:12 (find_package):
  Could not find module Findmylib.cmake or a configuration file for package
  mylib.

  Adjust CMAKE_MODULE_PATH to find Findmylib.cmake or set mylib_DIR to the
  directory containing a CMake configuration file for mylib.  The file will
  have one of the following names:

    mylibConfig.cmake
    mylib-config.cmake


So, to my understanding, cmake will search the module at CMAKE_MODULE_PATH
or at /usr/share/cmake-2.6/Modules/
Does it also search somewhere else such as:
/usr/local/share/cmake-2.6/Modules ?
I've tried this and apparently it doesn't search there... (maybe it searches
somewhere
else?)
If cmake does not do this at all... would this be useful? I think so,
personally... since
usually it is common to install libraries/programs at /usr/local/...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090825/af07fee5/attachment.htm>


More information about the CMake mailing list