[CMake] Unable to find GTK with cmake on Ubuntu

Philip Lowman philip at yhbt.com
Fri Dec 19 06:51:59 EST 2008


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

> Hi.
>
> I though I resolved my problem, but not.
>
> Actually,  my project can link gtk2 with my C source file, with the
> following include :
>
> #include <gtk-2.0/gtk/gtk.h>
>
> But, within gtk.h, gtk includes are linked with the following :
>
> #include <gtk/gdk.h> (for example)
>
> So, I can't build since I don't have access to my widgets.
>
> Like before, my CMakeLists.txt is something like that :
>
> SET(CMAKE_MODULE_PATH "/home/bobby/workspace/SipSec/gui")
>
> FIND_PACKAGE(GTK2 COMPONENTS gtk)
> include_directories (${GTK2_INCLUDE_DIRS})
>
> set( GUI_SRC gtkCallback.c interface.c widgetUI.c)
> add_library (sipsecgui  ${GUI_SRC} )
> target_link_libraries(sipsecgui ${GTK2_LIBRARIES} )
>
> How can I tell CMake to link Gtk2 as <gtk/*> instead of <gtk-2.0/gtk/*> ?
>

>
> Any ideas someone ?


I could probably help you add a hack to FindGTK2 to get what you want but
I'm pretty sure nearly everyone else out there uses the #include <gtk/*>
syntax.

The best thing for you to do would be to fix your #includes and in whatever
build system you're currently using just ensure "/usr/include/gtk-2.0" is in
the include path (I suspect it's already there otherwise you would have had
the same compilation issues you have now with your widgets).

If you have a lot of source files you could use the "sed" tool along with a
regular expression to accomplish your fix (make backups first obviously).

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


More information about the CMake mailing list