[CMake] Beginner's Question: Organizing Projects

Philip Lowman philip at yhbt.com
Wed Oct 27 13:33:49 EDT 2010


On Wed, Oct 27, 2010 at 11:54 AM, Ryan Pavlik <rpavlik at iastate.edu> wrote:

> On Wed, Oct 27, 2010 at 9:04 AM, Rolf Eike Beer <eike at sf-mail.de> wrote:
> >> Thanks. The way I understand this is that now instead of
> >>
> >> include_directories(${GTKMM_INCLUDE_DIRS})
> >>
> >> i would write something like
> >>
> >> include_directories(${GTKMM_INCLUDE_DIRS})
> >> # and at the end of the file
> >> set(INCLUDE_DIRECTORIES ${INCLUDE_DIRECTORIES} PARENT_SCOPE)
> >>
> >> ? I'd do the same with the LINK_DIRECTORIES, LINK_LIBRARIES property and
> >> for all other libraries?
> >
> > Don't set LINK_DIRECTORIES and LINK_LIBRARIES. When you are a beginner
> > probably every usage of them is wrong.
> >
> > You simply do
> >
> > TARGET_LINK_LIBRARIES(mytarget ${GTK_LIBRARIES}) (or however that is
> called)
> >
> > The only thing you need to "export upwards" in this case would be the
> > GTK_LIBRARIES variable.
> >
> > Eike
>
> This is good advice, however, in most cases, since you're using
> pkgconfig directly (which is not the recommended way), that will cause
> more failure.  Best thing to do is to create/find a cmake module for
> each of those packages, that might use pkgconfig for help finding the
> library, but that doesn't just use what it returns verbatim.
>

In that light, try out FindGTK2.cmake.  It comes with CMake and supports
Gtk/Glade/GtkMM/GladeMM on multiple platforms without relying on pkgconfig.

-- 
Philip Lowman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20101027/980b573c/attachment.htm>


More information about the CMake mailing list