[CMake] Unable to find GTK with cmake on Ubuntu

Philip Lowman philip at yhbt.com
Fri Dec 19 04:45:15 EST 2008


On Fri, Dec 19, 2008 at 4:40 AM, Pierrick Grasland <
pierrick.grasland at gmail.com> wrote:

> Hi,
>
> I just tried FindGTK2.cmake
>
> It correctly locate GTK2 library, but when I trying to build my project,
> GCC output a lot of error in GTK lib ...
>
> It seems to be unable to find definition of GTK.
>
> I copy / paste here my CMakeLists.txt (I think I forgot something) :
>
> SET(CMAKE_MODULE_PATH "/home/bobby/workspace/SipSec/gui")
>
> FIND_PACKAGE(GTK2 COMPONENTS gtk)
> include_directories (${GTK2_GTK_INCLUDE_DIR})
>
> set( GUI_SRC gtkCallback.c interface.c widgetUI.c)
> add_library (sipsecgui  ${GUI_SRC} ${GTK2_GTK_LIBRARIES})
> target_link_libraries(sipsecgui ${GTK2_GTK_LIBRARIES} )
>
>
> and some errors from GCC output :
>
> /usr/include/gtk-2.0/gtk/gtktextbufferrichtext.h:90: erreur: expected
> declaration specifiers before «G_END_DECLS»
> In file included from /usr/include/gtk-2.0/gtk/gtk.h:176,
>                  from /home/bobby/workspace/SipSec/gui/gtkCallback.h:12,
>                  from /home/bobby/workspace/SipSec/gui/gtkCallback.c:7:
> /usr/include/gtk-2.0/gtk/gtktextview.h:53: erreur: expected declaration
> specifiers before «GtkTextWindowType»
> /usr/include/gtk-2.0/gtk/gtktextview.h:57: erreur: storage class specified
> for parameter «GtkTextView»
>


Due to GTK's dependencies (header files in a dozen different directories and
many libraries) when using this module you should use:

INCLUDE_DIRECTORIES(${GTK2_INCLUDE_DIRS})
and
TARGET_LINK_LIBRARIES(foo ${GTK2_LIBRARIES})

The module appends all the stuff in two large lists exposed as
GTK2_INCLUDE_DIRS and GTK2_LIBRARIES.

-- 
Philip Lowman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20081219/42d9c1a1/attachment-0001.htm>


More information about the CMake mailing list