[CMake] Unable to find GTK with cmake on Ubuntu

Pierrick Grasland pierrick.grasland at gmail.com
Fri Dec 19 04:40:45 EST 2008


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»



On Fri, Dec 19, 2008 at 10:23 AM, Philip Lowman <philip at yhbt.com> wrote:

> On Thu, Dec 18, 2008 at 8:05 PM, Timothy M. Shead <tshead at k-3d.com> wrote:
>
>> Pierrick Grasland wrote:
>>
>> > I'm testing CMake with a little project, but I encounter a problem with
>> GTK.
>>
>> > I was building with autotools and pkg_config before, so I know I have
>> > GTK+-2.0 on my system.
>>
>> Since pkg-config is the "officially supported" way to obtain GTK
>> dependencies and compiler flag (I believe it was designed by many of the
>> same developers), I find that using CMake's pkg-config module works best
>> (even on Win32).  See the documentation at
>>
>> http://www.cmake.org/cmake/help/cmake2.6docs.html#module:FindPkgConfig
>>
>> and try something along the lines of
>>
>> find_package(PkgConfig)
>> pkg_check_modules(GTK gtk+-2.0)
>> include_directories(${GTK_INCLUDE_DIRS})
>
>
> I'm not having much luck on my system with pkg-config at the moment.
>
> GTK_INCLUDE_DIRS = C:/Program
> GTK_LIBRARY_DIRS = C:/Program
>
> Looks to be a problem with the pkg-config.exe I have and not FindPkgConfig
> judging by the output of "pkg-config --cflags gtk+-2.0"
>
> Also, I'm not sure how to configure pkg-config to give me debug libraries.
> All I can figure is I would have to perform this step manually in CMake
> script?
>
> Aside from the fact that pkg-config will tell me about library dependencies
> are there any advantages of using this tool within the context of CMake?  I
> only ask because in my experience GTK has been fairly stable in it's
> dependencies along the way from 2.0.  I know they added Cairo but exceptions
> like that can probably be handled within a properly written and tested
> FindGTK2.cmake
>
> --
> Philip Lowman
>
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake
>



-- 
Pierrick Grasland
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20081219/8eda40f3/attachment.htm>


More information about the CMake mailing list