Total cmake newbie needs some help

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Total cmake newbie needs some help

Edgar
I'm trying to help my friend get OpenLayer 2.1 to build and I'm having
some problems finding certain packages during the cmake call, and some
linking problems during the build process.

So, my first question is, what is a typical setup for finding a required
library dependency? There are several generated files named things like
FindALLEGRO.cmake, and FindFREETYPE.cmake, how do I generate those
files? I need to find both zlib and libpng in order to build the demo
programs.

My second questions is, how are link libraries set in the cmake build files?

Please be patient with me, I am a total newcomer to cmake, and my friend
really needs help with this to upgrade his MinGW, Allegro, and OpenLayer
versions....

Thanks,
Edgar

--

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
Reply | Threaded
Open this post in threaded view
|

Re: Total cmake newbie needs some help

David Cole
If you're a total newcomer to cmake, you should maybe start here:


And then see all the articles/videos/webinars linked to from this page:

  http://www.cmake.org/cmake/help/documentation.html

If you just want to get OpenLayer building quickly, may I suggest asking for help from the OpenLayer community.


HTH,
David


On Thu, Aug 16, 2012 at 7:00 PM, Edgar <[hidden email]> wrote:
I'm trying to help my friend get OpenLayer 2.1 to build and I'm having some problems finding certain packages during the cmake call, and some linking problems during the build process.

So, my first question is, what is a typical setup for finding a required library dependency? There are several generated files named things like FindALLEGRO.cmake, and FindFREETYPE.cmake, how do I generate those files? I need to find both zlib and libpng in order to build the demo programs.

My second questions is, how are link libraries set in the cmake build files?

Please be patient with me, I am a total newcomer to cmake, and my friend really needs help with this to upgrade his MinGW, Allegro, and OpenLayer versions....

Thanks,
Edgar

--

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


--

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
Reply | Threaded
Open this post in threaded view
|

Re: Total cmake newbie needs some help

Edgar
In reply to this post by Edgar
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?

--

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
Reply | Threaded
Open this post in threaded view
|

Re: Total cmake newbie needs some help

Andreas Pakulat-2
Hi,

On Sat, Aug 18, 2012 at 12:16 AM, Edgar
<[hidden email]> 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
Reply | Threaded
Open this post in threaded view
|

Re: Total cmake newbie needs some help

David Cole
On Sat, Aug 18, 2012 at 3:28 AM, Andreas Pakulat <[hidden email]> wrote:
Hi,

On Sat, Aug 18, 2012 at 12:16 AM, Edgar
<[hidden email]> 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


--

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
Reply | Threaded
Open this post in threaded view
|

Re: Total cmake newbie needs some help

Johannes Zarl
In reply to this post by Edgar
On Saturday, 18. August 2012, 00:16:41, Edgar wrote:
> I have these problems -
> 1) Cmake cannot find ZLIB
> 2) Cmake cannot find LIBPNG

> 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?

Those two are standard cmake modules[1][2]. You only have to point them to the
location of your zlib/libpng installation. You can help cmake by setting the
environment variable CMAKE_PREFIX_PATH to a colon-separated list of paths
(e.g. /myopt:/usr/local).

In your case it might even suffice to set the cmake variable ZLIB_ROOT (libpng
depends on zlib and therefore FindPNG.cmake will bail out if zlib is not
found).

> 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.

You should read up on target_link_libraries [3] for that. Normally the usage
pattern is something like the following:

FIND_PACKAGE(FOO REQUIRED)
TARGET_LINK_LIBRARIES(someTarget ${FOO_LIBRARIES})

Cheers,
  Johannes


[1] http://www.cmake.org/cmake/help/v2.8.9/cmake.html#module:FindZLIB
[2] http://www.cmake.org/cmake/help/v2.8.9/cmake.html#module:FindPNG
[3]
http://www.cmake.org/cmake/help/v2.8.9/cmake.html#command:target_link_libraries
--

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