[CMake] Unable to find GTK with cmake on Ubuntu

Pierrick Grasland pierrick.grasland at gmail.com
Thu Dec 18 10:15:28 EST 2008


Hello all,

I'm testing CMake with a little project, but I encounter a problem with GTK.

I have the following architecture with CMake 2.6-patch2 on ubuntu 8.04 :

src/
  gui/
  tools/
target/

My goal is to generate my project in target.

So I created a CMakeLists.txt in src :

cmake_minimum_required(VERSION 2.6)
project( MyProject )

include_directories( ${MyProject_SOURCE_DIR}/gui )
link_directories( ${MyProject_SOURCE_DIR}/gui )

include_directories( ${MyProject_SOURCE_DIR}/tools )
link_directories( ${MyProject_SOURCE_DIR}/tools )

add_subdirectory(gui)
add_subdirectory(tools)

set( MyProject_SRC main.c conf.c )
add_executable( myproject ${MyProject_SRC})

set( MyProject_LIB tools gui )
target_link_libraries(myproject ${MyProject_LIB} )

and, in src/gui/ the following CMakeLists.txt :

find_package (GTK REQUIRED)

include_directories (${GTK_INCLUDE_DIR})

set( GUI_SRC gtkCallback.c interface.c widgetUI.c)
add_library (gui  ${GUI_SRC} ${GTK_LIBRARIES})

But, when I run configure in cmake-gui, I have the following result :

GTK_..._NOTFOUND for all corresponding libraries in GTK.

and when I trying to make my project in target, I can't because gcc doesn't
know where is GTK

I was building with autotools and pkg_config before, so I know I have
GTK+-2.0 on my system.

I realized the migration between autotools and Cmake without a specialized
tools, in order to learn how to use CMake. I'm now stuck with this problem,
without a single clue (on CMake wiki or google) to correct it. I hope for
some help here.

Regards,


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


More information about the CMake mailing list