[prev in list] [next in list] [prev in thread] [next in thread] 

List:       cmake
Subject:    Re: [CMake] installing a module
From:       David Ojeda <david.ojeda () gmail ! com>
Date:       2009-08-28 8:48:51
Message-ID: e1eea59e0908280148l4bf48211k8487ebbf3653011 () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


On Tue, Aug 25, 2009 at 3:35 PM, Michael Wild <themiwi@gmail.com> wrote:

>
> On 25. Aug, 2009, at 15:23, David Ojeda wrote:
>
>  On Tue, Aug 25, 2009 at 12:47 PM, Andreas Pakulat <apaku@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/...
>>
>>
>
> You want to read http://www.cmake.org/cmake/help/cmake2.6docs.html#command:find_package,
> especially where it starts to talk about "config mode":
>
>  CMake constructs a set of possible installation prefixes for the package.
>>>> Under each prefix several directories are searched for a configuration file.
>>>> The tables below show the directories searched. Each entry is meant for
>>>> installation trees following Windows (W), UNIX (U), or Apple (A)
>>>> conventions.
>>>>
>>>> <prefix>/ (W)
>>>> <prefix>/(cmake|CMake)/ (W)
>>>> <prefix>/<name>*/ (W)
>>>> <prefix>/<name>*/(cmake|CMake)/ (W)
>>>> <prefix>/(share|lib)/cmake/<name>*/ (U)
>>>> <prefix>/(share|lib)/<name>*/ (U)
>>>> <prefix>/(share|lib)/<name>*/(cmake|CMake)/ (U)
>>>> On systems supporting OS X Frameworks and Application Bundles the
>>>> following directories are searched for frameworks or bundles containing a
>>>> configuration file:
>>>>
>>>> <prefix>/<name>.framework/Resources/ (A)
>>>> <prefix>/<name>.framework/Resources/CMake/ (A)
>>>> <prefix>/<name>.framework/Versions/*/Resources/ (A)
>>>> <prefix>/<name>.framework/Versions/*/Resources/CMake/ (A)
>>>> <prefix>/<name>.app/Contents/Resources/ (A)
>>>> <prefix>/<name>.app/Contents/Resources/CMake/ (A)
>>>> In all cases the <name> is treated as case-insensitive and corresponds
>>>> to any of the names specified (<package> or names given by NAMES). If
>>>> PATH_SUFFIXES is specified the suffixes are appended to each (W) or (U)
>>>> directory entry one-by-one.
>>>>
>>>>
> Michael
>

Thank you Michael, I did not know this.
I found another interesting solution, just by filling the HINT section of
the find_package

David

[Attachment #5 (text/html)]

<div class="gmail_quote">On Tue, Aug 25, 2009 at 3:35 PM, Michael Wild <span \
dir="ltr">&lt;<a href="mailto:themiwi@gmail.com">themiwi@gmail.com</a>&gt;</span> \
wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, \
204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

<div><div></div><div class="h5"><br>
On 25. Aug, 2009, at 15:23, David Ojeda wrote:<br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); \
margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> On Tue, Aug 25, 2009 at 12:47 PM, \
Andreas Pakulat &lt;<a href="mailto:apaku@gmx.de" \
target="_blank">apaku@gmx.de</a>&gt; wrote:<br> <br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); \
margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> On 25.08.09 12:37:46, David Ojeda \
wrote:<br> <blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, \
204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> I have a shared library \
that I managed to compile and install using<br> </blockquote>
cmake.<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); \
margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> This is working great but now I want \
to use this library in another<br> cmake-based development. Normally, as with any \
other shared library, I<br> </blockquote>
use a<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); \
margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> FindPackage to get the include and \
linker flags. However, since I am<br> </blockquote>
using<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); \
margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> my shared library, I wrote a cmake \
module. Once again this is working ok<br> </blockquote>
and<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); \
margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> I would like to include this module \
as a part of the files installed by<br> </blockquote>
the<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); \
margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> library.<br>
</blockquote>
<br>
So you don&#39;t want that, you want it to be either part of cmake or part of<br>
all projects using that library. The reason is simple, if the library is<br>
not installed, its find-module won&#39;t be installed. Hence upon the cmake-run<br>
in the project using the lib you&#39;ll get a cryptic error message that<br>
library_DIR is not set properly.<br>
<br>
</blockquote>
<br>
Thank you for your response Andreas,<br>
<br>
Actually I get a not so cryptic error, which says that it does not find the<br>
module:<br>
<br>
CMake Warning at CMakeLists.txt:12 (find_package):<br>
 Could not find module Findmylib.cmake or a configuration file for package<br>
 mylib.<br>
<br>
 Adjust CMAKE_MODULE_PATH to find Findmylib.cmake or set mylib_DIR to the<br>
 directory containing a CMake configuration file for mylib.  The file will<br>
 have one of the following names:<br>
<br>
   mylibConfig.cmake<br>
   mylib-config.cmake<br>
<br>
<br>
So, to my understanding, cmake will search the module at CMAKE_MODULE_PATH<br>
or at /usr/share/cmake-2.6/Modules/<br>
Does it also search somewhere else such as:<br>
/usr/local/share/cmake-2.6/Modules ?<br>
I&#39;ve tried this and apparently it doesn&#39;t search there... (maybe it \
searches<br> somewhere<br>
else?)<br>
If cmake does not do this at all... would this be useful? I think so,<br>
personally... since<br>
usually it is common to install libraries/programs at /usr/local/...<br>
<br>
</blockquote>
<br>
<br></div></div>
You want to read <a href="http://www.cmake.org/cmake/help/cmake2.6docs.html#command" \
target="_blank">http://www.cmake.org/cmake/help/cmake2.6docs.html#command</a>:find_package, \
especially where it starts to talk about &quot;config mode&quot;:<br>


<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); \
margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><blockquote class="gmail_quote" \
style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; \
padding-left: 1ex;">

<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); \
margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> CMake constructs a set of possible \
installation prefixes for the package. Under each prefix several directories are \
searched for a configuration file. The tables below show the directories searched. \
Each entry is meant for installation trees following Windows (W), UNIX (U), or Apple \
(A) conventions.<br>


<br>
&lt;prefix&gt;/ (W)<br>
&lt;prefix&gt;/(cmake|CMake)/ (W)<br>
&lt;prefix&gt;/&lt;name&gt;*/ (W)<br>
&lt;prefix&gt;/&lt;name&gt;*/(cmake|CMake)/ (W)<br>
&lt;prefix&gt;/(share|lib)/cmake/&lt;name&gt;*/ (U)<br>
&lt;prefix&gt;/(share|lib)/&lt;name&gt;*/ (U)<br>
&lt;prefix&gt;/(share|lib)/&lt;name&gt;*/(cmake|CMake)/ (U)<br>
On systems supporting OS X Frameworks and Application Bundles the following \
directories are searched for frameworks or bundles containing a configuration \
file:<br> <br>
&lt;prefix&gt;/&lt;name&gt;.framework/Resources/ (A)<br>
&lt;prefix&gt;/&lt;name&gt;.framework/Resources/CMake/ (A)<br>
&lt;prefix&gt;/&lt;name&gt;.framework/Versions/*/Resources/ (A)<br>
&lt;prefix&gt;/&lt;name&gt;.framework/Versions/*/Resources/CMake/ (A)<br>
&lt;prefix&gt;/&lt;name&gt;.app/Contents/Resources/ (A)<br>
&lt;prefix&gt;/&lt;name&gt;.app/Contents/Resources/CMake/ (A)<br>
In all cases the &lt;name&gt; is treated as case-insensitive and corresponds to any \
of the names specified (&lt;package&gt; or names given by NAMES). If PATH_SUFFIXES is \
specified the suffixes are appended to each (W) or (U) directory entry \
one-by-one.<br>


<br>
</blockquote></blockquote></blockquote>
<br>
Michael<br>
</blockquote></div><br>Thank you Michael, I did not know this.<br>I found another \
interesting solution, just by filling the HINT section of the \
find_package<br><br>David<br>



_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic