On Sat, Aug 18, 2012 at 3:28 AM, Andreas Pakulat <span dir="ltr">&lt;<a href="mailto:apaku@gmx.de" target="_blank">apaku@gmx.de</a>&gt;</span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi,<br>
<div class="im"><br>
On Sat, Aug 18, 2012 at 12:16 AM, Edgar<br>
&lt;<a href="mailto:edgarreynaldo@members.allegro.cc">edgarreynaldo@members.allegro.cc</a>&gt; wrote:<br>
&gt; I&#39;ve already looked at the cmake tutorial, and it isn&#39;t that great. It<br>
&gt; starts really simple but then goes into really complex things that most<br>
&gt; people might not even use.<br>
&gt;<br>
&gt; Also, there is currently no such thing as &#39;The Openlayer community&#39; - the<br>
&gt; project is unsupported, and no longer in active development due to inactive<br>
&gt; development for Allegro 4. So if there is anyone who can help it is this<br>
&gt; cmake mailing list, and that&#39;s all.<br>
&gt;<br>
&gt; I am trying to get Openlayer 2pt1 to build with MinGW 4.5 and up, which it<br>
&gt; currently doesn&#39;t do. I&#39;ve been able to fix compilation errors, but not<br>
&gt; build errors related to cmake.<br>
&gt;<br>
&gt; I have these problems -<br>
&gt; 1) Cmake cannot find ZLIB<br>
&gt; 2) Cmake cannot find LIBPNG<br>
&gt; 3) There are undefined reference errors during the linking process for the<br>
&gt; OpenLayer demos, and I don&#39;t know how to properly link the necessary<br>
&gt; libraries using cmake.<br>
&gt;<br>
&gt; There are some .cmake files named FindALLEGRO, and FindFREETYPE, and those<br>
&gt; work properly. Do I need to create similar cmake files for zlib and libpng?<br>
&gt;<br>
&gt; How does cmake find required libraries and link to them?<br>
<br>
</div>find_library is used to find libraries, find_file or find_path to find<br>
the include directories. Usually those are bundled into a find-module<br>
called Find&lt;LibName&gt;.cmake similar to your FindALLEGRO.cmake file.<br>
<br>
You can configure where the functions search for libs when calling<br>
them and also via some special cmake-variables (cmake --help-command<br>
find_library gives you more information on that). The find-modules are<br>
usually set up in a way that they search the default-installation path<br>
of the library on the respective platforms. If users install the lib<br>
elsewhere they are required to set the cmake-variables when<br>
configuring the project.<br>
<span class="HOEnZb"><font color="#888888"><br>
Andreas<br>
</font></span><div class="HOEnZb"><div class="h5">--<br>
<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br>
</div></div></blockquote></div><br><div><br></div><div>CMake already has built-in find modules for PNG and ZLIB.</div><div><br></div><div>You should be able to do:</div><div>find_package(PNG)</div><div><br></div><div>The FindPNG module internally does a find_package(ZLIB) so you don&#39;t have to do that if you&#39;re calling find_package(PNG).</div>
<div><br></div><div>That said, I don&#39;t know if these modules work as intended under a mingw system, or if you have to have your own mingw-based installs of png and zlib to get them to work. Or you might have to set some variables if the automatic &quot;find&quot; doesn&#39;t just find them where they are.</div>
<div><br></div><div>Hopefully somebody more intimately involved with regularly building under mingw, and also using PNG, will chime in here...</div><div><br></div><div><br></div><div>HTH,</div><div>David</div><div><br></div>