<div class="gmail_quote">On Tue, Aug 25, 2009 at 3:35 PM, Michael Wild <span dir="ltr"><<a href="mailto:themiwi@gmail.com">themiwi@gmail.com</a>></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 <<a href="mailto:apaku@gmx.de" target="_blank">apaku@gmx.de</a>> 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'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't be installed. Hence upon the cmake-run<br>
in the project using the lib you'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've tried this and apparently it doesn'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 "config mode":<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>
<prefix>/ (W)<br>
<prefix>/(cmake|CMake)/ (W)<br>
<prefix>/<name>*/ (W)<br>
<prefix>/<name>*/(cmake|CMake)/ (W)<br>
<prefix>/(share|lib)/cmake/<name>*/ (U)<br>
<prefix>/(share|lib)/<name>*/ (U)<br>
<prefix>/(share|lib)/<name>*/(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>
<prefix>/<name>.framework/Resources/ (A)<br>
<prefix>/<name>.framework/Resources/CMake/ (A)<br>
<prefix>/<name>.framework/Versions/*/Resources/ (A)<br>
<prefix>/<name>.framework/Versions/*/Resources/CMake/ (A)<br>
<prefix>/<name>.app/Contents/Resources/ (A)<br>
<prefix>/<name>.app/Contents/Resources/CMake/ (A)<br>
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.<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>