[CMake] Total cmake newbie needs some help

David Cole david.cole at kitware.com
Sat Aug 18 08:18:32 EDT 2012


On Sat, Aug 18, 2012 at 3:28 AM, Andreas Pakulat <apaku at gmx.de> wrote:

> Hi,
>
> On Sat, Aug 18, 2012 at 12:16 AM, Edgar
> <edgarreynaldo at members.allegro.cc> wrote:
> > I've already looked at the cmake tutorial, and it isn't that great. It
> > starts really simple but then goes into really complex things that most
> > people might not even use.
> >
> > Also, there is currently no such thing as 'The Openlayer community' - the
> > project is unsupported, and no longer in active development due to
> inactive
> > development for Allegro 4. So if there is anyone who can help it is this
> > cmake mailing list, and that's all.
> >
> > I am trying to get Openlayer 2pt1 to build with MinGW 4.5 and up, which
> it
> > currently doesn't do. I've been able to fix compilation errors, but not
> > build errors related to cmake.
> >
> > I have these problems -
> > 1) Cmake cannot find ZLIB
> > 2) Cmake cannot find LIBPNG
> > 3) There are undefined reference errors during the linking process for
> the
> > OpenLayer demos, and I don't know how to properly link the necessary
> > libraries using cmake.
> >
> > There are some .cmake files named FindALLEGRO, and FindFREETYPE, and
> those
> > work properly. Do I need to create similar cmake files for zlib and
> libpng?
> >
> > How does cmake find required libraries and link to them?
>
> find_library is used to find libraries, find_file or find_path to find
> the include directories. Usually those are bundled into a find-module
> called Find<LibName>.cmake similar to your FindALLEGRO.cmake file.
>
> You can configure where the functions search for libs when calling
> them and also via some special cmake-variables (cmake --help-command
> find_library gives you more information on that). The find-modules are
> usually set up in a way that they search the default-installation path
> of the library on the respective platforms. If users install the lib
> elsewhere they are required to set the cmake-variables when
> configuring the project.
>
> Andreas
> --
>
> 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
>


CMake already has built-in find modules for PNG and ZLIB.

You should be able to do:
find_package(PNG)

The FindPNG module internally does a find_package(ZLIB) so you don't have
to do that if you're calling find_package(PNG).

That said, I don'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 "find" doesn't just find them where they are.

Hopefully somebody more intimately involved with regularly building under
mingw, and also using PNG, will chime in here...


HTH,
David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20120818/a5716427/attachment-0001.htm>


More information about the CMake mailing list