[CMake] Total cmake newbie needs some help

Andreas Pakulat apaku at gmx.de
Sat Aug 18 03:28:50 EDT 2012


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


More information about the CMake mailing list